Register now for Android Dev Summit 2019!

CommandButton

class CommandButton : VersionedParcelable
kotlin.Any
   ↳ androidx.media2.session.MediaSession.CommandButton

Button for a SessionCommand 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

SessionCommand?

Get command associated with this button.

CharSequence?

Display name of the button.

Bundle?

Extra information of the button.

Int

Resource id of the button in this package.

Boolean

Return whether it's enabled.

Public methods

getCommand

@Nullable fun getCommand(): SessionCommand?

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

Return
SessionCommand?: command or null

getDisplayName

@Nullable fun getDisplayName(): CharSequence?

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

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

getExtras

@Nullable fun getExtras(): Bundle?

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

Return
Bundle?:

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.

isEnabled

fun isEnabled(): Boolean

Return whether it's enabled.

Return
Boolean: true if enabled. false otherwise.