CommandButton

class CommandButton : VersionedParcelable
kotlin.Any
   ↳ 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

Builder for CommandButton.

Public methods
Boolean

Return whether it's enabled.

Bundle?

Extra information of the button.

String?

Display name of the button.

SessionCommand2?

Get command associated with this button.

Int

Resource id of the button in this package.

Public methods

isEnabled

fun isEnabled(): Boolean

Return whether it's enabled.

Return
Boolean: true if enabled. false otherwise.

getExtras

@Nullable fun getExtras(): Bundle?

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

Return
Bundle?:

getDisplayName

@Nullable fun getDisplayName(): String?

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

Return
String?: custom display name. Can be null or empty.

getCommand

@Nullable fun getCommand(): SessionCommand2?

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

Return
SessionCommand2?: command or null

getIconResId

fun getIconResId(): Int

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

Return
Int: resource id of the icon. Can be 0.