MediaBrowserCompat.MediaItem


class MediaBrowserCompat.MediaItem : Parcelable


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

Constants

const Parcelable.Creator<MediaBrowserCompat.MediaItem!>!
const Int

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

const Int

Flag: Indicates that the item is playable.

Public constructors

MediaItem(description: MediaDescriptionCompat, flags: Int)

Create a new MediaItem for use in browsing media.

Public functions

Int
java-static MediaBrowserCompat.MediaItem!
fromMediaItem(itemObj: Any!)

Creates an instance from a framework android.media.browse.MediaBrowser.MediaItem object.

java-static (Mutable)List<MediaBrowserCompat.MediaItem!>!

Creates a list of MediaItem objects from a framework android.media.browse.MediaBrowser.MediaItem object list.

MediaDescriptionCompat

Returns the description of the media.

Int

Gets the flags of the item.

String?

Returns the media id in the MediaDescriptionCompat for this item.

Boolean

Returns whether this item is browsable.

Boolean

Returns whether this item is playable.

String
Unit
writeToParcel(out: Parcel!, flags: Int)

Constants

CREATOR

Added in 1.1.0
const val CREATORParcelable.Creator<MediaBrowserCompat.MediaItem!>!

FLAG_BROWSABLE

Added in 1.1.0
const val FLAG_BROWSABLE = 1: Int

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

FLAG_PLAYABLE

Added in 1.1.0
const val FLAG_PLAYABLE = 2: Int

Flag: Indicates that the item is playable.

The id of this item may be passed to playFromMediaId to start playing it.

Public constructors

MediaItem

Added in 1.1.0
MediaItem(description: MediaDescriptionCompat, flags: Int)

Create a new MediaItem for use in browsing media.

Parameters
description: MediaDescriptionCompat

The description of the media, which must include a media id.

flags: Int

The flags for this item.

Public functions

describeContents

Added in 1.1.0
fun describeContents(): Int

fromMediaItem

Added in 1.1.0
java-static fun fromMediaItem(itemObj: Any!): MediaBrowserCompat.MediaItem!

Creates an instance from a framework android.media.browse.MediaBrowser.MediaItem object.

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

Parameters
itemObj: Any!

A android.media.browse.MediaBrowser.MediaItem object.

Returns
MediaBrowserCompat.MediaItem!

An equivalent MediaItem object, or null if none.

fromMediaItemList

Added in 1.1.0
java-static fun fromMediaItemList(itemList: (Mutable)List<Any!>!): (Mutable)List<MediaBrowserCompat.MediaItem!>!

Creates a list of MediaItem objects from a framework android.media.browse.MediaBrowser.MediaItem object list.

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

Parameters
itemList: (Mutable)List<Any!>!

A list of android.media.browse.MediaBrowser.MediaItem objects.

Returns
(Mutable)List<MediaBrowserCompat.MediaItem!>!

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

getDescription

Added in 1.1.0
fun getDescription(): MediaDescriptionCompat

Returns the description of the media.

getFlags

Added in 1.1.0
fun getFlags(): Int

Gets the flags of the item.

getMediaId

Added in 1.1.0
fun getMediaId(): String?

Returns the media id in the MediaDescriptionCompat for this item.

isBrowsable

Added in 1.1.0
fun isBrowsable(): Boolean

Returns whether this item is browsable.

See also
FLAG_BROWSABLE

isPlayable

Added in 1.1.0
fun isPlayable(): Boolean

Returns whether this item is playable.

See also
FLAG_PLAYABLE

toString

fun toString(): String

writeToParcel

Added in 1.1.0
fun writeToParcel(out: Parcel!, flags: Int): Unit