PlaybackStateCompat.CustomAction

public final class PlaybackStateCompat.CustomAction implements Parcelable


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

Summary

Nested types

Builder for CustomAction objects.

Public methods

int
static PlaybackStateCompat.CustomAction
fromCustomAction(Object customActionObj)

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

String

Returns the action of the CustomAction.

Object

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. e.g. "Favorite"

String
void
writeToParcel(Parcel dest, int flags)

Inherited Constants

From android.os.Parcelable
static final int
static final int

Constants

CREATOR

Added in 1.1.0
public static final Parcelable.Creator<PlaybackStateCompat.CustomActionCREATOR

Public methods

describeContents

Added in 1.1.0
public int describeContents()

fromCustomAction

Added in 1.1.0
public static PlaybackStateCompat.CustomAction fromCustomAction(Object customActionObj)

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

This method is only supported on API 21+.

Parameters
Object customActionObj

A android.media.session.PlaybackState.CustomAction object, or null if none.

Returns
PlaybackStateCompat.CustomAction

An equivalent PlaybackStateCompat.CustomAction object, or null if none.

getAction

Added in 1.1.0
public String getAction()

Returns the action of the CustomAction.

Returns
String

The action of the CustomAction.

getCustomAction

Added in 1.1.0
public Object getCustomAction()

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

This method is only supported on API 21+.

Returns
Object

An equivalent android.media.session.PlaybackState.CustomAction object, or null if none.

getExtras

Added in 1.1.0
public Bundle getExtras()

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.

Returns
Bundle

Optional arguments for the CustomAction.

getIcon

Added in 1.1.0
public int getIcon()

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

Returns
int

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

getName

Added in 1.1.0
public CharSequence getName()

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

Returns
CharSequence

The display name of this CustomAction.

toString

public String toString()

writeToParcel

Added in 1.1.0
public void writeToParcel(Parcel dest, int flags)