Added in API level 21

MediaItem


class MediaItem : Parcelable
kotlin.Any
   ↳ android.media.browse.MediaBrowser.MediaItem

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
static Int

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

static Int

Flag: Indicates that the item is playable.

Inherited constants
Public constructors
MediaItem(description: MediaDescription, flags: Int)

Create a new MediaItem for use in browsing media.

Public methods
open Int

open MediaDescription

Returns the description of the media.

open Int

Gets the flags of the item.

open String?

Returns the media id in the MediaDescription for this item.

open Boolean

Returns whether this item is browsable.

open Boolean

Returns whether this item is playable.

open String

open Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<MediaBrowser.MediaItem!>

Constants

FLAG_BROWSABLE

Added in API level 21
static val FLAG_BROWSABLE: Int

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

Value: 1

FLAG_PLAYABLE

Added in API level 21
static val FLAG_PLAYABLE: Int

Flag: Indicates that the item is playable.

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

Value: 2

Public constructors

MediaItem

Added in API level 21
MediaItem(
    description: MediaDescription,
    flags: Int)

Create a new MediaItem for use in browsing media.

Parameters
description MediaDescription: The description of the media, which must include a media id. This value cannot be null.
flags Int: The flags for this item. Value is either 0 or a combination of android.media.browse.MediaBrowser.MediaItem#FLAG_BROWSABLE, and android.media.browse.MediaBrowser.MediaItem#FLAG_PLAYABLE

Public methods

describeContents

Added in API level 21
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getDescription

Added in API level 21
open fun getDescription(): MediaDescription

Returns the description of the media.

Return
MediaDescription This value cannot be null.

getFlags

Added in API level 21
open fun getFlags(): Int

Gets the flags of the item.

Return
Int Value is either 0 or a combination of android.media.browse.MediaBrowser.MediaItem#FLAG_BROWSABLE, and android.media.browse.MediaBrowser.MediaItem#FLAG_PLAYABLE

getMediaId

Added in API level 21
open fun getMediaId(): String?

Returns the media id in the MediaDescription for this item.

Return
String? This value may be null.

isBrowsable

Added in API level 21
open fun isBrowsable(): Boolean

Returns whether this item is browsable.

See Also

isPlayable

Added in API level 21
open fun isPlayable(): Boolean

Returns whether this item is playable.

See Also

toString

Added in API level 21
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 21
open fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit
Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 21
static val CREATOR: Parcelable.Creator<MediaBrowser.MediaItem!>