public final class

MediaSession.CommandButton

extends java.lang.Object

implements VersionedParcelable

 java.lang.Object

↳androidx.media2.session.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()

Gets the command associated with this button.

public java.lang.CharSequencegetDisplayName()

Gets the display name of the button.

public BundlegetExtras()

Gets extra information of the button.

public intgetIconResId()

Gets the resource id of the button in this package.

public booleanisEnabled()

Returns whether it's enabled.

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

Methods

public SessionCommand getCommand()

Gets the 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()

Gets the 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()

Gets the 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()

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

Returns:

public boolean isEnabled()

Returns whether it's enabled.

Returns:

true if enabled. false otherwise.