public final class

MediaSession.CommandButton

extends java.lang.Object

implements VersionedParcelable

 java.lang.Object

↳androidx.media2.MediaSession.CommandButton

Overview

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

Methods
public SessionCommandgetCommand()

Get command associated with this button.

public java.lang.CharSequencegetDisplayName()

Display name of the button.

public BundlegetExtras()

Extra information of the button.

public intgetIconResId()

Resource id of the button in this package.

public booleanisEnabled()

Return whether it's enabled.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public SessionCommand getCommand()

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

Returns:

command or null

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:

resource id of the icon. Can be 0.

public java.lang.CharSequence getDisplayName()

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

Returns:

custom display name. Can be null or empty.

public Bundle getExtras()

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

Returns:

public boolean isEnabled()

Return whether it's enabled.

Returns:

true if enabled. false otherwise.