Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/MediaMetadata#nestedclasses) \| [Constants](https://developer.android.com/reference/android/media/MediaMetadata#constants) \| [Inherited Constants](https://developer.android.com/reference/android/media/MediaMetadata#inhconstants) \| [Fields](https://developer.android.com/reference/android/media/MediaMetadata#lfields) \| [Methods](https://developer.android.com/reference/android/media/MediaMetadata#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/MediaMetadata#inhmethods)

# MediaMetadata

*** ** * ** ***

` public final class MediaMetadata `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.MediaMetadata |

<br />

*** ** * ** ***

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

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/media/MediaMetadata.Builder` Use to build MediaMetadata objects. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM` The album title for the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART` The artwork for the album of the media's original source as a `https://developer.android.com/reference/android/graphics/Bitmap`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ARTIST` The artist for the album of the media's original source. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART_URI` The artwork for the album of the media's original source as a Uri formatted String. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART` The artwork for the media as a `https://developer.android.com/reference/android/graphics/Bitmap`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ARTIST` The artist of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART_URI` The artwork for the media as a Uri formatted String. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_AUTHOR` The author of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_BT_FOLDER_TYPE` The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPILATION` The compilation status of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPOSER` The composer of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DATE` The date the media was created or published. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISC_NUMBER` The disc number for the media's original source. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_DESCRIPTION` A description that is suitable for display to the user. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON` An icon or thumbnail that is suitable for display to the user. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON_URI` A Uri formatted String for an icon or thumbnail that is suitable for display to the user. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_SUBTITLE` A subtitle that is suitable for display to the user. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_TITLE` A title that is suitable for display to the user. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DURATION` The duration of the media in ms. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_GENRE` The genre of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_ID` A String key for identifying the content. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_URI` A Uri formatted String representing the content. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_NUM_TRACKS` The number of tracks in the media's original source. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_RATING` The overall rating for the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TITLE` The title of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TRACK_NUMBER` The track number for the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_USER_RATING` The user's rating for the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_WRITER` The writer of the media. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_YEAR` The year the media was created or published as a long. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/media/MediaMetadata>` | `https://developer.android.com/reference/android/media/MediaMetadata#CREATOR` <br /> |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/media/MediaMetadata#containsKey(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns true if the given key is contained in the metadata |
| ` int` | ` https://developer.android.com/reference/android/media/MediaMetadata#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/media/MediaMetadata#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the contents of this object to another MediaMetadata object. |
| ` https://developer.android.com/reference/android/graphics/Bitmap` | ` https://developer.android.com/reference/android/media/MediaMetadata#getBitmap(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns a `https://developer.android.com/reference/android/graphics/Bitmap` for the given key or null if no bitmap exists for the given key. |
| ` int` | ` https://developer.android.com/reference/android/media/MediaMetadata#getBitmapDimensionLimit()() ` Gets the width/height limit (in pixels) for the bitmaps when this metadata was created. |
| ` https://developer.android.com/reference/android/media/MediaDescription` | ` https://developer.android.com/reference/android/media/MediaMetadata#getDescription()() ` Returns a simple description of this metadata for display purposes. |
| ` long` | ` https://developer.android.com/reference/android/media/MediaMetadata#getLong(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns the value associated with the given key, or 0L if no long exists for the given key. |
| ` https://developer.android.com/reference/android/media/Rating` | ` https://developer.android.com/reference/android/media/MediaMetadata#getRating(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns a `https://developer.android.com/reference/android/media/Rating` for the given key or null if no rating exists for the given key. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/media/MediaMetadata#getString(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns the text value associated with the given key as a String, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/media/MediaMetadata#getText(java.lang.String)(https://developer.android.com/reference/java/lang/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. |
| ` int` | ` https://developer.android.com/reference/android/media/MediaMetadata#hashCode()() ` Returns a hash code value for the object. |
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/media/MediaMetadata#keySet()() ` Returns a Set containing the Strings used as keys in this metadata. |
| ` int` | ` https://developer.android.com/reference/android/media/MediaMetadata#size()() ` Returns the number of fields in this metadata. |
| ` void` | ` https://developer.android.com/reference/android/media/MediaMetadata#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### METADATA_KEY_ALBUM

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ALBUM
```

The album title for the media.

<br />

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

### METADATA_KEY_ALBUM_ART

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ALBUM_ART
```

The artwork for the album of the media's original source as a `https://developer.android.com/reference/android/graphics/Bitmap`.

The artwork should be relatively small and may be scaled down by the system if it is too large. For higher resolution artwork `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART_URI` should be used instead.

<br />

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

### METADATA_KEY_ALBUM_ARTIST

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ALBUM_ARTIST
```

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

<br />

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

### METADATA_KEY_ALBUM_ART_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ALBUM_ART_URI
```

The artwork for the album of the media's original source as a Uri formatted String. The artwork can be loaded using a combination of `https://developer.android.com/reference/android/content/ContentResolver#openInputStream(android.net.Uri)` and `https://developer.android.com/reference/android/graphics/BitmapFactory#decodeStream(java.io.InputStream)`.

For the best results, Uris should use the content:// style and support `https://developer.android.com/reference/android/content/ContentResolver#EXTRA_SIZE` for retrieving scaled artwork through `https://developer.android.com/reference/android/content/ContentResolver#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle)`.

<br />

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

### METADATA_KEY_ART

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ART
```

The artwork for the media as a `https://developer.android.com/reference/android/graphics/Bitmap`.

The artwork should be relatively small and may be scaled down by the system if it is too large. For higher resolution artwork `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART_URI` should be used instead.

<br />

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

### METADATA_KEY_ARTIST

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ARTIST
```

The artist of the media.

<br />

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

### METADATA_KEY_ART_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_ART_URI
```

The artwork for the media as a Uri formatted String. The artwork can be loaded using a combination of `https://developer.android.com/reference/android/content/ContentResolver#openInputStream(android.net.Uri)` and `https://developer.android.com/reference/android/graphics/BitmapFactory#decodeStream(java.io.InputStream)`.

For the best results, Uris should use the content:// style and support `https://developer.android.com/reference/android/content/ContentResolver#EXTRA_SIZE` for retrieving scaled artwork through `https://developer.android.com/reference/android/content/ContentResolver#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle)`.

<br />

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

### METADATA_KEY_AUTHOR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_AUTHOR
```

The author of the media.

<br />

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

### METADATA_KEY_BT_FOLDER_TYPE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_BT_FOLDER_TYPE
```

The bluetooth folder type of the media specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5. It should be one of the following:

- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_MIXED`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_TITLES`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_ALBUMS`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_ARTISTS`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_GENRES`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_PLAYLISTS`
- `https://developer.android.com/reference/android/media/MediaDescription#BT_FOLDER_TYPE_YEARS`

<br />

<br />

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

### METADATA_KEY_COMPILATION

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_COMPILATION
```

The compilation status of the media.

<br />

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

### METADATA_KEY_COMPOSER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_COMPOSER
```

The composer of the media.

<br />

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

### METADATA_KEY_DATE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DATE
```

The date the media was created or published. The format is unspecified but RFC 3339 is recommended.

<br />

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

### METADATA_KEY_DISC_NUMBER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISC_NUMBER
```

The disc number for the media's original source.

<br />

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

### METADATA_KEY_DISPLAY_DESCRIPTION

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISPLAY_DESCRIPTION
```

A description that is suitable for display to the user. When displaying more information for media described by this metadata this should be preferred to other fields if present.

<br />

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

### METADATA_KEY_DISPLAY_ICON

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISPLAY_ICON
```

An icon or thumbnail that is suitable for display to the user. When displaying an icon for media described by this metadata this should be preferred to other fields if present. This must be a `https://developer.android.com/reference/android/graphics/Bitmap`.

The icon should be relatively small and may be scaled down by the system if it is too large. For higher resolution artwork `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON_URI` should be used instead.

<br />

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

### METADATA_KEY_DISPLAY_ICON_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISPLAY_ICON_URI
```

A Uri formatted String for an icon or thumbnail that is suitable for display to the user. When displaying more information for media described by this metadata the display description should be preferred to other fields when present. The icon can be loaded using a combination of `https://developer.android.com/reference/android/content/ContentResolver#openInputStream(android.net.Uri)` and `https://developer.android.com/reference/android/graphics/BitmapFactory#decodeStream(java.io.InputStream)`.

For the best results, Uris should use the content:// style and support `https://developer.android.com/reference/android/content/ContentResolver#EXTRA_SIZE` for retrieving scaled artwork through `https://developer.android.com/reference/android/content/ContentResolver#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle)`.

<br />

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

### METADATA_KEY_DISPLAY_SUBTITLE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISPLAY_SUBTITLE
```

A subtitle that is suitable for display to the user. When displaying a second line for media described by this metadata this should be preferred to other fields if present.

<br />

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

### METADATA_KEY_DISPLAY_TITLE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_DISPLAY_TITLE
```

A title that is suitable for display to the user. This will generally be the same as `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TITLE` but may differ for some formats. When displaying media described by this metadata this should be preferred if present.

<br />

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

### METADATA_KEY_DURATION

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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).

<br />

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

### METADATA_KEY_GENRE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_GENRE
```

The genre of the media.

<br />

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

### METADATA_KEY_MEDIA_ID

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_MEDIA_ID
```

A String key for identifying the content. This value is specific to the service providing the content. If used, this should be a persistent unique key for the underlying content. It may be used with `https://developer.android.com/reference/android/media/session/MediaController.TransportControls#playFromMediaId(java.lang.String,%20android.os.Bundle)` to initiate playback when provided by a `https://developer.android.com/reference/android/media/browse/MediaBrowser` connected to the same app.

<br />

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

### METADATA_KEY_MEDIA_URI

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_MEDIA_URI
```

A Uri formatted String representing the content. This value is specific to the service providing the content. It may be used with `https://developer.android.com/reference/android/media/session/MediaController.TransportControls#playFromUri(android.net.Uri,%20android.os.Bundle)` to initiate playback when provided by a `https://developer.android.com/reference/android/media/browse/MediaBrowser` connected to the same app.

<br />

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

### METADATA_KEY_NUM_TRACKS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_NUM_TRACKS
```

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

<br />

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

### METADATA_KEY_RATING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_RATING
```

The overall rating for the media.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/Rating`

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

### METADATA_KEY_TITLE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_TITLE
```

The title of the media.

<br />

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

### METADATA_KEY_TRACK_NUMBER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_TRACK_NUMBER
```

The track number for the media.

<br />

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

### METADATA_KEY_USER_RATING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_USER_RATING
```

The user's rating for the media.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/Rating`

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

### METADATA_KEY_WRITER

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_WRITER
```

The writer of the media.

<br />

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

### METADATA_KEY_YEAR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String METADATA_KEY_YEAR
```

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

<br />

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

## Fields

### CREATOR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<MediaMetadata> CREATOR
```

<br />

<br />

## Public methods

### containsKey

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean containsKey (String key)
```

Returns true if the given key is contained in the metadata

<br />

| Parameters ||
|---|---|
| `key` | `String`: a String key <br /> |

| Returns ||
|---|---|
| `boolean` | true if the key exists in this metadata, false otherwise <br /> |

### describeContents

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Compares the contents of this object to another MediaMetadata object. It does not compare Bitmaps and Ratings as the media player can choose to forgo these fields depending on how you retrieve the MediaMetadata.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: The Metadata object to compare this object against <br /> |

| Returns ||
|---|---|
| `boolean` | Whether or not the two objects have matching fields (excluding Bitmaps and Ratings) <br /> |

### getBitmap

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bitmap getBitmap (String key)
```

Returns a `https://developer.android.com/reference/android/graphics/Bitmap` for the given key or null if no bitmap exists for the given key.

<br />

| Parameters ||
|---|---|
| `key` | `String`: The key the value is stored under. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap` | A `https://developer.android.com/reference/android/graphics/Bitmap` or null <br /> |

### getBitmapDimensionLimit

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getBitmapDimensionLimit ()
```

Gets the width/height limit (in pixels) for the bitmaps when this metadata was created. This method always returns a positive value.

If it returns `https://developer.android.com/reference/java/lang/Integer#MAX_VALUE`, then no scaling down was applied to the bitmaps when this metadata was created.

If it returns another positive value, then all the bitmaps in this metadata has width/height not greater than this limit. Bitmaps may have been scaled down according to the limit.

<br />

<br />

| Returns ||
|---|---|
| `int` | Value is 1 or greater <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/MediaMetadata.Builder#setBitmapDimensionLimit(int)`

### getDescription

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MediaDescription getDescription ()
```

Returns a simple description of this metadata for display purposes.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/MediaDescription` | A simple description of this metadata. This value cannot be `null`. <br /> |

### getLong

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getLong (String key)
```

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

<br />

| Parameters ||
|---|---|
| `key` | `String`: The key the value is stored under. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DURATION` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_YEAR` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TRACK_NUMBER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_NUM_TRACKS` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISC_NUMBER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_BT_FOLDER_TYPE` |

| Returns ||
|---|---|
| `long` | a long value <br /> |

### getRating

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Rating getRating (String key)
```

Returns a `https://developer.android.com/reference/android/media/Rating` for the given key or null if no rating exists for the given key.

<br />

| Parameters ||
|---|---|
| `key` | `String`: The key the value is stored under. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_USER_RATING` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_RATING` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/Rating` | A `https://developer.android.com/reference/android/media/Rating` or null <br /> |

### getString

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getString (String key)
```

Returns the text value associated with the given key as a String, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key. This is equivalent to calling `https://developer.android.com/reference/android/media/MediaMetadata#getText(java.lang.String)` if the value is not null.

<br />

| Parameters ||
|---|---|
| `key` | `String`: The key the value is stored under. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ARTIST` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_AUTHOR` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_WRITER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPOSER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPILATION` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DATE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_GENRE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ARTIST` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_TITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_SUBTITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_DESCRIPTION` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_ID` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_URI` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a String value, or null <br /> |

### getText

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getText (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.

<br />

| Parameters ||
|---|---|
| `key` | `String`: The key the value is stored under. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_TITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ARTIST` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_AUTHOR` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_WRITER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPOSER` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_COMPILATION` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DATE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_GENRE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ARTIST` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ART_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_ALBUM_ART_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_TITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_SUBTITLE` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_DESCRIPTION` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_DISPLAY_ICON_URI` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_ID` - `https://developer.android.com/reference/android/media/MediaMetadata#METADATA_KEY_MEDIA_URI` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | a CharSequence value, or null <br /> |

### hashCode

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### keySet

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Set<String> keySet ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>` | a Set of String keys <br /> |

### size

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int size ()
```

Returns the number of fields in this metadata.

<br />

| Returns ||
|---|---|
| `int` | The number of fields in the metadata. <br /> |

### writeToParcel

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |