Android APIs
public final class

MediaMetadata

extends Object
implements Parcelable
java.lang.Object
   ↳ android.media.MediaMetadata

Class Overview

Contains metadata about an item, such as the title, artist, etc.

Summary

Nested Classes
class MediaMetadata.Builder Use to build MediaMetadata objects. 
Constants
String METADATA_KEY_ALBUM The album title for the media.
String METADATA_KEY_ALBUM_ART The artwork for the album of the media's original source as a Bitmap.
String METADATA_KEY_ALBUM_ARTIST The artist for the album of the media's original source.
String METADATA_KEY_ALBUM_ART_URI The artwork for the album of the media's original source as a Uri style String.
String METADATA_KEY_ART The artwork for the media as a Bitmap.
String METADATA_KEY_ARTIST The artist of the media.
String METADATA_KEY_ART_URI The artwork for the media as a Uri style String.
String METADATA_KEY_AUTHOR The author of the media.
String METADATA_KEY_COMPILATION The compilation status of the media.
String METADATA_KEY_COMPOSER The composer of the media.
String METADATA_KEY_DATE The date the media was created or published as TODO determine format.
String METADATA_KEY_DISC_NUMBER The disc number for the media's original source.
String METADATA_KEY_DURATION The duration of the media in ms.
String METADATA_KEY_GENRE The genre of the media.
String METADATA_KEY_NUM_TRACKS The number of tracks in the media's original source.
String METADATA_KEY_RATING The overall rating for the media.
String METADATA_KEY_TITLE The title of the media.
String METADATA_KEY_TRACK_NUMBER The track number for the media.
String METADATA_KEY_USER_RATING The user's rating for the media.
String METADATA_KEY_WRITER The writer of the media.
String METADATA_KEY_YEAR The year the media was created or published as a long.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<MediaMetadata> CREATOR
Public Methods
boolean containsKey(String key)
Returns true if the given key is contained in the metadata
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Bitmap getBitmap(String key)
Return a Bitmap for the given key or null if no bitmap exists for the given key.
long getLong(String key)
Returns the value associated with the given key, or 0L if no long exists for the given key.
Rating getRating(String key)
Return a Rating for the given key or null if no rating exists for the given key.
String getString(String key)
Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.
Set<String> keySet()
Returns a Set containing the Strings used as keys in this metadata.
int size()
Get the number of fields in this metadata.
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String METADATA_KEY_ALBUM

The album title for the media.

Constant Value: "android.media.metadata.ALBUM"

public static final String METADATA_KEY_ALBUM_ART

The artwork for the album of the media's original source as a Bitmap.

Constant Value: "android.media.metadata.ALBUM_ART"

public static final String METADATA_KEY_ALBUM_ARTIST

The artist for the album of the media's original source.

Constant Value: "android.media.metadata.ALBUM_ARTIST"

public static final String METADATA_KEY_ALBUM_ART_URI

The artwork for the album of the media's original source as a Uri style String.

Constant Value: "android.media.metadata.ALBUM_ART_URI"

public static final String METADATA_KEY_ART

The artwork for the media as a Bitmap.

Constant Value: "android.media.metadata.ART"

public static final String METADATA_KEY_ARTIST

The artist of the media.

Constant Value: "android.media.metadata.ARTIST"

public static final String METADATA_KEY_ART_URI

The artwork for the media as a Uri style String.

Constant Value: "android.media.metadata.ART_URI"

public static final String METADATA_KEY_AUTHOR

The author of the media.

Constant Value: "android.media.metadata.AUTHOR"

public static final String METADATA_KEY_COMPILATION

The compilation status of the media.

Constant Value: "android.media.metadata.COMPILATION"

public static final String METADATA_KEY_COMPOSER

The composer of the media.

Constant Value: "android.media.metadata.COMPOSER"

public static final String METADATA_KEY_DATE

The date the media was created or published as TODO determine format.

Constant Value: "android.media.metadata.DATE"

public static final String METADATA_KEY_DISC_NUMBER

The disc number for the media's original source.

Constant Value: "android.media.metadata.DISC_NUMBER"

public static final String METADATA_KEY_DURATION

The duration of the media in ms. A negative duration indicates that the duration is unknown (or infinite).

Constant Value: "android.media.metadata.DURATION"

public static final String METADATA_KEY_GENRE

The genre of the media.

Constant Value: "android.media.metadata.GENRE"

public static final String METADATA_KEY_NUM_TRACKS

The number of tracks in the media's original source.

Constant Value: "android.media.metadata.NUM_TRACKS"

public static final String METADATA_KEY_RATING

The overall rating for the media.

See Also
Constant Value: "android.media.metadata.RATING"

public static final String METADATA_KEY_TITLE

The title of the media.

Constant Value: "android.media.metadata.TITLE"

public static final String METADATA_KEY_TRACK_NUMBER

The track number for the media.

Constant Value: "android.media.metadata.TRACK_NUMBER"

public static final String METADATA_KEY_USER_RATING

The user's rating for the media.

See Also
Constant Value: "android.media.metadata.USER_RATING"

public static final String METADATA_KEY_WRITER

The writer of the media.

Constant Value: "android.media.metadata.WRITER"

public static final String METADATA_KEY_YEAR

The year the media was created or published as a long.

Constant Value: "android.media.metadata.YEAR"

Fields

public static final Creator<MediaMetadata> CREATOR

Public Methods

public boolean containsKey (String key)

Returns true if the given key is contained in the metadata

Parameters
key a String key
Returns
  • true if the key exists in this metadata, false otherwise

public int describeContents ()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public Bitmap getBitmap (String key)

Return a Bitmap for the given key or null if no bitmap exists for the given key.

Parameters
key The key the value is stored under
Returns

public long getLong (String key)

Returns the value associated with the given key, or 0L if no long exists for the given key.

Parameters
key The key the value is stored under
Returns
  • a long value

public Rating getRating (String key)

Return a Rating for the given key or null if no rating exists for the given key.

Parameters
key The key the value is stored under
Returns

public String getString (String key)

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Parameters
key The key the value is stored under
Returns
  • a String value, or null

public Set<String> keySet ()

Returns a Set containing the Strings used as keys in this metadata.

Returns
  • a Set of String keys

public int size ()

Get the number of fields in this metadata.

Returns
  • The number of fields in the metadata.

public void writeToParcel (Parcel dest, int flags)

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.