MediaSession2.CommandButton

public static final class MediaSession2.CommandButton
extends Object implements VersionedParcelable

java.lang.Object
   ↳ androidx.media2.MediaSession2.CommandButton


Button for a SessionCommand2 that will be shown by the controller.

It's up to the controller's decision to respect or ignore this customization request.

Summary

Nested classes

class MediaSession2.CommandButton.Builder

Builder for MediaSession2.CommandButton

Public methods

SessionCommand2 getCommand()

Get command associated with this button.

String getDisplayName()

Display name of the button.

Bundle getExtras()

Extra information of the button.

int getIconResId()

Resource id of the button in this package.

boolean isEnabled()

Return whether it's enabled.

Inherited methods

Public methods

getCommand

public SessionCommand2 getCommand ()

Get command associated with this button. Can be null if the button isn't enabled and only providing placeholder.

Returns
SessionCommand2 command or null

getDisplayName

public String getDisplayName ()

Display name of the button. Can be null or empty if the command is predefined and custom name isn't needed.

Returns
String custom display name. Can be null or empty.

getExtras

public Bundle getExtras ()

Extra information of the button. It's private information between session and controller.

Returns
Bundle

getIconResId

public int getIconResId ()

Resource id of the button in this package. Can be 0 if the command is predefined and custom icon isn't needed.

Returns
int resource id of the icon. Can be 0.

isEnabled

public boolean isEnabled ()

Return whether it's enabled.

Returns
boolean true if enabled. false otherwise.