Java Code Examples for android.media.MediaMetadata#METADATA_KEY_ALBUM
The following examples show how to use
android.media.MediaMetadata#METADATA_KEY_ALBUM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MusicLibrary.java From android-music-player with Apache License 2.0 | 6 votes |
public static MediaMetadata getMetadata(Context ctx, String mediaId) { MediaMetadata metadataWithoutBitmap = music.get(mediaId); Bitmap albumArt = getAlbumBitmap(ctx, mediaId); // Since MediaMetadata is immutable, we need to create a copy to set the album art // We don't set it initially on all items so that they don't take unnecessary memory MediaMetadata.Builder builder = new MediaMetadata.Builder(); for (String key: new String[]{MediaMetadata.METADATA_KEY_MEDIA_ID, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_GENRE, MediaMetadata.METADATA_KEY_TITLE}) { builder.putString(key, metadataWithoutBitmap.getString(key)); } builder.putLong(MediaMetadata.METADATA_KEY_DURATION, metadataWithoutBitmap.getLong(MediaMetadata.METADATA_KEY_DURATION)); builder.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, albumArt); return builder.build(); }
Example 2
Source File: MusicLibrary.java From android-music-player with Apache License 2.0 | 6 votes |
public static MediaMetadata getMetadata(Context ctx, String mediaId) { MediaMetadata metadataWithoutBitmap = music.get(mediaId); Bitmap albumArt = getAlbumBitmap(ctx, mediaId); // Since MediaMetadata is immutable, we need to create a copy to set the album art // We don't set it initially on all items so that they don't take unnecessary memory MediaMetadata.Builder builder = new MediaMetadata.Builder(); for (String key: new String[]{MediaMetadata.METADATA_KEY_MEDIA_ID, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_GENRE, MediaMetadata.METADATA_KEY_TITLE}) { builder.putString(key, metadataWithoutBitmap.getString(key)); } builder.putLong(MediaMetadata.METADATA_KEY_DURATION, metadataWithoutBitmap.getLong(MediaMetadata.METADATA_KEY_DURATION)); builder.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, albumArt); return builder.build(); }
Example 3
Source File: MusicLibrary.java From io2015-codelabs with Apache License 2.0 | 6 votes |
public static MediaMetadata getMetadata(Context ctx, String mediaId) { MediaMetadata metadataWithoutBitmap = music.get(mediaId); Bitmap albumArt = getAlbumBitmap(ctx, mediaId); // Since MediaMetadata is immutable, we need to create a copy to set the album art // We don't set it initially on all items so that they don't take unnecessary memory MediaMetadata.Builder builder = new MediaMetadata.Builder(); for (String key: new String[]{MediaMetadata.METADATA_KEY_MEDIA_ID, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_GENRE, MediaMetadata.METADATA_KEY_TITLE}) { builder.putString(key, metadataWithoutBitmap.getString(key)); } builder.putLong(MediaMetadata.METADATA_KEY_DURATION, metadataWithoutBitmap.getLong(MediaMetadata.METADATA_KEY_DURATION)); builder.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, albumArt); return builder.build(); }
Example 4
Source File: MusicLibrary.java From io2015-codelabs with Apache License 2.0 | 6 votes |
public static MediaMetadata getMetadata(Context ctx, String mediaId) { MediaMetadata metadataWithoutBitmap = music.get(mediaId); Bitmap albumArt = getAlbumBitmap(ctx, mediaId); // Since MediaMetadata is immutable, we need to create a copy to set the album art // We don't set it initially on all items so that they don't take unnecessary memory MediaMetadata.Builder builder = new MediaMetadata.Builder(); for (String key: new String[]{MediaMetadata.METADATA_KEY_MEDIA_ID, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_GENRE, MediaMetadata.METADATA_KEY_TITLE}) { builder.putString(key, metadataWithoutBitmap.getString(key)); } builder.putLong(MediaMetadata.METADATA_KEY_DURATION, metadataWithoutBitmap.getLong(MediaMetadata.METADATA_KEY_DURATION)); builder.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, albumArt); return builder.build(); }