MediaDescriptionCompat

public final class MediaDescriptionCompat implements Parcelable


A simple set of metadata for a media item suitable for display. This can be created using the Builder or retrieved from existing metadata using getDescription.

Summary

Nested types

Builder for MediaDescriptionCompat objects.

Constants

static final long

The type of folder that contains folders categorized by album as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that contains folders categorized by artist as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that contains folders categorized by genre as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that is unknown or contains media elements of mixed types as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that contains folders categorized by playlist as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that contains media elements only as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final long

The type of folder that contains folders categorized by year as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final Parcelable.Creator<MediaDescriptionCompat>
static final String
EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE"

Used as a long extra field to indicate the bluetooth folder type of the media item as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

static final String
EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS"

Used as a long extra field to indicate the download status of the media item.

static final long

The status value to indicate the media item is downloaded for later offline playback.

static final long

The status value to indicate the media item is being downloaded.

static final long

The status value to indicate the media item is not downloaded.

Public methods

int
static MediaDescriptionCompat
fromMediaDescription(Object descriptionObj)

Creates an instance from a framework android.media.MediaDescription object.

@Nullable CharSequence

Returns a description suitable for display or null.

@Nullable Bundle

Returns any extras that were added to the description.

@Nullable Bitmap

Returns a bitmap icon suitable for display or null.

@Nullable Uri

Returns a Uri for an icon suitable for display or null.

Object

Gets the underlying framework android.media.MediaDescription object.

@Nullable String

Returns the media id or null.

@Nullable Uri

Returns a Uri representing this content or null.

@Nullable CharSequence

Returns a subtitle suitable for display or null.

@Nullable CharSequence

Returns a title suitable for display or null.

String
void
writeToParcel(Parcel dest, int flags)

Inherited Constants

From android.os.Parcelable
static final int
static final int

Constants

BT_FOLDER_TYPE_ALBUMS

Added in 1.1.0
public static final long BT_FOLDER_TYPE_ALBUMS = 2

The type of folder that contains folders categorized by album as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_ARTISTS

Added in 1.1.0
public static final long BT_FOLDER_TYPE_ARTISTS = 3

The type of folder that contains folders categorized by artist as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_GENRES

Added in 1.1.0
public static final long BT_FOLDER_TYPE_GENRES = 4

The type of folder that contains folders categorized by genre as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_MIXED

Added in 1.1.0
public static final long BT_FOLDER_TYPE_MIXED = 0

The type of folder that is unknown or contains media elements of mixed types as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_PLAYLISTS

Added in 1.1.0
public static final long BT_FOLDER_TYPE_PLAYLISTS = 5

The type of folder that contains folders categorized by playlist as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_TITLES

Added in 1.1.0
public static final long BT_FOLDER_TYPE_TITLES = 1

The type of folder that contains media elements only as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

BT_FOLDER_TYPE_YEARS

Added in 1.1.0
public static final long BT_FOLDER_TYPE_YEARS = 6

The type of folder that contains folders categorized by year as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5.

CREATOR

Added in 1.1.0
public static final Parcelable.Creator<MediaDescriptionCompatCREATOR

EXTRA_BT_FOLDER_TYPE

Added in 1.1.0
public static final String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE"

Used as a long extra field to indicate the bluetooth folder type of the media item as specified in the section 6.10.2.2 of the Bluetooth AVRCP 1.5. This is valid only for MediaBrowserCompat.MediaItem with FLAG_BROWSABLE. The value should be one of the following:

See also
getExtras

EXTRA_DOWNLOAD_STATUS

Added in 1.1.0
public static final String EXTRA_DOWNLOAD_STATUS = "android.media.extra.DOWNLOAD_STATUS"

Used as a long extra field to indicate the download status of the media item. The value should be one of the following:

See also
getExtras

STATUS_DOWNLOADED

Added in 1.1.0
public static final long STATUS_DOWNLOADED = 2

The status value to indicate the media item is downloaded for later offline playback.

STATUS_DOWNLOADING

Added in 1.1.0
public static final long STATUS_DOWNLOADING = 1

The status value to indicate the media item is being downloaded.

STATUS_NOT_DOWNLOADED

Added in 1.1.0
public static final long STATUS_NOT_DOWNLOADED = 0

The status value to indicate the media item is not downloaded.

Public methods

describeContents

Added in 1.1.0
public int describeContents()

fromMediaDescription

Added in 1.1.0
public static MediaDescriptionCompat fromMediaDescription(Object descriptionObj)

Creates an instance from a framework android.media.MediaDescription object.

This method is only supported on API 21+.

Parameters
Object descriptionObj

A android.media.MediaDescription object, or null if none.

Returns
MediaDescriptionCompat

An equivalent MediaMetadataCompat object, or null if none.

getDescription

Added in 1.1.0
public @Nullable CharSequence getDescription()

Returns a description suitable for display or null.

Returns
@Nullable CharSequence

A description or null.

getExtras

Added in 1.1.0
public @Nullable Bundle getExtras()

Returns any extras that were added to the description.

Returns
@Nullable Bundle

A bundle of extras or null.

getIconBitmap

Added in 1.1.0
public @Nullable Bitmap getIconBitmap()

Returns a bitmap icon suitable for display or null.

Returns
@Nullable Bitmap

An icon or null.

getIconUri

Added in 1.1.0
public @Nullable Uri getIconUri()

Returns a Uri for an icon suitable for display or null.

Returns
@Nullable Uri

An icon uri or null.

getMediaDescription

Added in 1.1.0
public Object getMediaDescription()

Gets the underlying framework android.media.MediaDescription object.

This method is only supported on LOLLIPOP and later.

Returns
Object

An equivalent android.media.MediaDescription object, or null if none.

getMediaId

Added in 1.1.0
public @Nullable String getMediaId()

Returns the media id or null. See METADATA_KEY_MEDIA_ID.

getMediaUri

Added in 1.1.0
public @Nullable Uri getMediaUri()

Returns a Uri representing this content or null.

Returns
@Nullable Uri

A media Uri or null.

getSubtitle

Added in 1.1.0
public @Nullable CharSequence getSubtitle()

Returns a subtitle suitable for display or null.

Returns
@Nullable CharSequence

A subtitle or null.

getTitle

Added in 1.1.0
public @Nullable CharSequence getTitle()

Returns a title suitable for display or null.

Returns
@Nullable CharSequence

A title or null.

toString

public String toString()

writeToParcel

Added in 1.1.0
public void writeToParcel(Parcel dest, int flags)