public class

MediaBrowserCompat.MediaItem

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.legacy.MediaBrowserCompat.MediaItem

Overview

A class with information on a single media item for use in browsing/searching media. MediaItems are application dependent so we cannot guarantee that they contain the right values.

Summary

Fields
public static final <any>CREATOR

public static final intFLAG_BROWSABLE

Flag: Indicates that the item has children of its own.

public static final intFLAG_PLAYABLE

Flag: Indicates that the item is playable.

Constructors
publicMediaItem(MediaDescriptionCompat description, int flags)

Create a new MediaItem for use in browsing media.

Methods
public intdescribeContents()

public static MediaBrowserCompat.MediaItemfromMediaItem(java.lang.Object itemObj)

Creates an instance from a framework object.

public static java.util.List<MediaBrowserCompat.MediaItem>fromMediaItemList(java.util.List<java.lang.Object> itemList)

Creates a list of MediaBrowserCompat.MediaItem objects from a framework object list.

public MediaDescriptionCompatgetDescription()

Returns the description of the media.

public intgetFlags()

Gets the flags of the item.

public java.lang.StringgetMediaId()

Returns the media id in the MediaDescriptionCompat for this item.

public booleanisBrowsable()

Returns whether this item is browsable.

public booleanisPlayable()

Returns whether this item is playable.

public java.lang.StringtoString()

public voidwriteToParcel(Parcel out, int flags)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public static final int FLAG_BROWSABLE

Flag: Indicates that the item has children of its own.

public static final int FLAG_PLAYABLE

Flag: Indicates that the item is playable.

The id of this item may be passed to MediaControllerCompat.TransportControls.playFromMediaId(String, Bundle) to start playing it.

public static final <any> CREATOR

Constructors

public MediaItem(MediaDescriptionCompat description, int flags)

Create a new MediaItem for use in browsing media.

Parameters:

description: The description of the media, which must include a media id.
flags: The flags for this item.

Methods

public static MediaBrowserCompat.MediaItem fromMediaItem(java.lang.Object itemObj)

Creates an instance from a framework object.

This method is only supported on API 21+. On API 20 and below, it returns null.

Parameters:

itemObj: A object.

Returns:

An equivalent MediaBrowserCompat.MediaItem object, or null if none.

public static java.util.List<MediaBrowserCompat.MediaItem> fromMediaItemList(java.util.List<java.lang.Object> itemList)

Creates a list of MediaBrowserCompat.MediaItem objects from a framework object list.

This method is only supported on API 21+. On API 20 and below, it returns null.

Parameters:

itemList: A list of objects.

Returns:

An equivalent list of MediaBrowserCompat.MediaItem objects, or null if none.

public int describeContents()

public void writeToParcel(Parcel out, int flags)

public java.lang.String toString()

public int getFlags()

Gets the flags of the item.

public boolean isBrowsable()

Returns whether this item is browsable.

See also: MediaBrowserCompat.MediaItem.FLAG_BROWSABLE

public boolean isPlayable()

Returns whether this item is playable.

See also: MediaBrowserCompat.MediaItem.FLAG_PLAYABLE

public MediaDescriptionCompat getDescription()

Returns the description of the media.

public java.lang.String getMediaId()

Returns the media id in the MediaDescriptionCompat for this item.

See also: MediaMetadataCompat.METADATA_KEY_MEDIA_ID