FileDocCategorySizeDatePackage
MediaDescriptionCompat.javaAPI DocAndroid 5.1 API11095Thu Mar 12 22:22:56 GMT 2015android.support.v4.media

MediaDescriptionCompat

public final class MediaDescriptionCompat extends Object implements android.os.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 {@link MediaMetadataCompat#getDescription()}.

Fields Summary
private final String
mMediaId
A unique persistent id for the content or null.
private final CharSequence
mTitle
A primary title suitable for display or null.
private final CharSequence
mSubtitle
A subtitle suitable for display or null.
private final CharSequence
mDescription
A description suitable for display or null.
private final android.graphics.Bitmap
mIcon
A bitmap icon suitable for display or null.
private final android.net.Uri
mIconUri
A Uri for an icon suitable for display or null.
private final android.os.Bundle
mExtras
Extras for opaque use by apps/system.
private Object
mDescriptionObj
A cached copy of the equivalent framework object.
public static final Parcelable.Creator
CREATOR
Constructors Summary
private MediaDescriptionCompat(String mediaId, CharSequence title, CharSequence subtitle, CharSequence description, android.graphics.Bitmap icon, android.net.Uri iconUri, android.os.Bundle extras)

        mMediaId = mediaId;
        mTitle = title;
        mSubtitle = subtitle;
        mDescription = description;
        mIcon = icon;
        mIconUri = iconUri;
        mExtras = extras;
    
private MediaDescriptionCompat(android.os.Parcel in)

        mMediaId = in.readString();
        mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mSubtitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mIcon = in.readParcelable(null);
        mIconUri = in.readParcelable(null);
        mExtras = in.readBundle();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public static android.support.v4.media.MediaDescriptionCompatfromMediaDescription(java.lang.Object descriptionObj)
Creates an instance from a framework {@link android.media.MediaDescription} object.

This method is only supported on API 21+.

param
descriptionObj A {@link android.media.MediaDescription} object, or null if none.
return
An equivalent {@link MediaMetadataCompat} object, or null if none.

        if (descriptionObj == null || Build.VERSION.SDK_INT < 21) {
            return null;
        }

        Builder bob = new Builder();
        bob.setMediaId(MediaDescriptionCompatApi21.getMediaId(descriptionObj));
        bob.setTitle(MediaDescriptionCompatApi21.getTitle(descriptionObj));
        bob.setSubtitle(MediaDescriptionCompatApi21.getSubtitle(descriptionObj));
        bob.setDescription(MediaDescriptionCompatApi21.getDescription(descriptionObj));
        bob.setIconBitmap(MediaDescriptionCompatApi21.getIconBitmap(descriptionObj));
        bob.setIconUri(MediaDescriptionCompatApi21.getIconUri(descriptionObj));
        bob.setExtras(MediaDescriptionCompatApi21.getExtras(descriptionObj));
        MediaDescriptionCompat descriptionCompat = bob.build();
        descriptionCompat.mDescriptionObj = descriptionObj;

        return descriptionCompat;
    
public java.lang.CharSequencegetDescription()
Returns a description suitable for display or null.

return
A description or null.

        return mDescription;
    
public android.os.BundlegetExtras()
Returns any extras that were added to the description.

return
A bundle of extras or null.

        return mExtras;
    
public android.graphics.BitmapgetIconBitmap()
Returns a bitmap icon suitable for display or null.

return
An icon or null.

        return mIcon;
    
public android.net.UrigetIconUri()
Returns a Uri for an icon suitable for display or null.

return
An icon uri or null.

        return mIconUri;
    
public java.lang.ObjectgetMediaDescription()
Gets the underlying framework {@link android.media.MediaDescription} object.

This method is only supported on {@link android.os.Build.VERSION_CODES#LOLLIPOP} and later.

return
An equivalent {@link android.media.MediaDescription} object, or null if none.

        if (mDescriptionObj != null || Build.VERSION.SDK_INT < 21) {
            return mDescriptionObj;
        }
        Object bob = MediaDescriptionCompatApi21.Builder.newInstance();
        MediaDescriptionCompatApi21.Builder.setMediaId(bob, mMediaId);
        MediaDescriptionCompatApi21.Builder.setTitle(bob, mTitle);
        MediaDescriptionCompatApi21.Builder.setSubtitle(bob, mSubtitle);
        MediaDescriptionCompatApi21.Builder.setDescription(bob, mDescription);
        MediaDescriptionCompatApi21.Builder.setIconBitmap(bob, mIcon);
        MediaDescriptionCompatApi21.Builder.setIconUri(bob, mIconUri);
        MediaDescriptionCompatApi21.Builder.setExtras(bob, mExtras);
        mDescriptionObj = MediaDescriptionCompatApi21.Builder.build(bob);

        return mDescriptionObj;
    
public java.lang.StringgetMediaId()
Returns the media id or null. See {@link MediaMetadataCompat#METADATA_KEY_MEDIA_ID}.

        return mMediaId;
    
public java.lang.CharSequencegetSubtitle()
Returns a subtitle suitable for display or null.

return
A subtitle or null.

        return mSubtitle;
    
public java.lang.CharSequencegetTitle()
Returns a title suitable for display or null.

return
A title or null.

        return mTitle;
    
public java.lang.StringtoString()

        return mTitle + ", " + mSubtitle + ", " + mDescription;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        if (Build.VERSION.SDK_INT < 21) {
            dest.writeString(mMediaId);
            TextUtils.writeToParcel(mTitle, dest, flags);
            TextUtils.writeToParcel(mSubtitle, dest, flags);
            TextUtils.writeToParcel(mDescription, dest, flags);
            dest.writeParcelable(mIcon, flags);
            dest.writeParcelable(mIconUri, flags);
            dest.writeBundle(mExtras);
        } else {
            MediaDescriptionCompatApi21.writeToParcel(getMediaDescription(), dest, flags);
        }