Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

CustomAction

class CustomAction : Parcelable
kotlin.Any
   ↳ android.support.v4.media.session.PlaybackStateCompat.CustomAction

CustomActions can be used to extend the capabilities of the standard transport controls by exposing app specific actions to Controllers.

Summary

Nested classes

Builder for CustomAction objects.

Public methods

Int

static PlaybackStateCompat.CustomAction!
fromCustomAction(customActionObj: Any!)

Creates an instance from a framework android.media.session.PlaybackState.CustomAction object.

String!

Returns the action of the CustomAction.

Any!

Gets the underlying framework android.media.session.PlaybackState.CustomAction object.

Bundle!

Returns extras which provide additional application-specific information about the action, or null if none.

Int

Returns the resource id of the icon in the Session's package.

CharSequence!

Returns the display name of this action.

String

Unit
writeToParcel(dest: Parcel!, flags: Int)

Properties

static Creator<PlaybackStateCompat.CustomAction!>!

Public methods

describeContents

fun describeContents(): Int

fromCustomAction

static fun fromCustomAction(customActionObj: Any!): PlaybackStateCompat.CustomAction!

Creates an instance from a framework android.media.session.PlaybackState.CustomAction object.

This method is only supported on API 21+.

Parameters
customActionObj Any!: A android.media.session.PlaybackState.CustomAction object, or null if none.
Return
PlaybackStateCompat.CustomAction!: An equivalent PlaybackStateCompat.CustomAction object, or null if none.

getAction

fun getAction(): String!

Returns the action of the CustomAction.

Return
String!: The action of the CustomAction.

getCustomAction

fun getCustomAction(): Any!

Gets the underlying framework android.media.session.PlaybackState.CustomAction object.

This method is only supported on API 21+.

Return
Any!: An equivalent android.media.session.PlaybackState.CustomAction object, or null if none.

getExtras

fun getExtras(): Bundle!

Returns extras which provide additional application-specific information about the action, or null if none. These arguments are meant to be consumed by a MediaControllerCompat if it knows how to handle them.

Return
Bundle!: Optional arguments for the CustomAction.

getIcon

fun getIcon(): Int

Returns the resource id of the icon in the Session's package.

Return
Int: The resource id of the icon in the Session's package.

getName

fun getName(): CharSequence!

Returns the display name of this action. e.g. "Favorite"

Return
CharSequence!: The display name of this CustomAction.

toString

fun toString(): String

writeToParcel

fun writeToParcel(dest: Parcel!, flags: Int): Unit

Properties

CREATOR

static val CREATOR: Creator<PlaybackStateCompat.CustomAction!>!