# PlaybackStateCompat.CustomAction

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1  
Summary:[Nested Classes](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#nestedclasses)\|[Inherited Constants](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#inhconstants)\|[Fields](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#lfields)\|[Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#)  

# PlaybackStateCompat.CustomAction

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static
final

class
PlaybackStateCompat.CustomAction
`  
`

extends Object


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)`


`

|---|-------------------------------------------------------------------|
| java.lang.Object                                                     ||
| ↳ | android.support.v4.media.session.PlaybackStateCompat.CustomAction |

<br />

*** ** * ** ***

[CustomActions](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)can be used to extend the capabilities of the standard transport controls by exposing app specific actions to[Controllers](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat).

## Summary

|                                                                                                                                                            ### Nested classes                                                                                                                                                            ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder) Builder for[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)objects. |

|                                                                                                                                                                                     ### Inherited constants                                                                                                                                                                                      |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#)From interface` android.os.Parcelable ` |-------|----------------------------------------| | `int` | `CONTENTS_FILE_DESCRIPTOR` <br />      | | `int` | `PARCELABLE_WRITE_RETURN_VALUE` <br /> | |

|                                                                                                                                                                                              ### Fields                                                                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html)`<`[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)`>` | [CREATOR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#CREATOR) <br /> |

|                                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                                       ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                                                  | ` `[describeContents](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#describeContents())`() `                                                                                                                                                                                                              |
| ` static `[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction) | ` `[fromCustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#fromCustomAction(java.lang.Object))`(Object customActionObj) ` Creates an instance from a framework[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object. |
| ` String`                                                                                                                                               | ` `[getAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getAction())`() ` Returns the action of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction).                                                    |
| ` Object`                                                                                                                                               | ` `[getCustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getCustomAction())`() ` Gets the underlying framework[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object.                                                |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                             | ` `[getExtras](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getExtras())`() ` Returns extras which provide additional application-specific information about the action, or null if none.                                                                                                                |
| ` int`                                                                                                                                                  | ` `[getIcon](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getIcon())`() ` Returns the resource id of the icon in the[Session's](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat)package.                                                                     |
| ` CharSequence`                                                                                                                                         | ` `[getName](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getName())`() ` Returns the display name of this action.                                                                                                                                                                                       |
| ` String`                                                                                                                                               | ` `[toString](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#toString())`() `                                                                                                                                                                                                                              |
| ` void`                                                                                                                                                 | ` `[writeToParcel](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#writeToParcel(android.os.Parcel, int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel.html)` dest, int flags) `                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction#)From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)` ` |------------------|--------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` describeContents() `                                                                                       | | ` abstract void` | ` writeToParcel(`[Parcel](https://developer.android.com/reference/android/os/Parcel.html)` arg0, int arg1) ` | ||

## Fields

### CREATOR

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Creator<PlaybackStateCompat.CustomAction> CREATOR
```

<br />

<br />

## Public methods

### describeContents

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int describeContents ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### fromCustomAction

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
PlaybackStateCompat.CustomAction fromCustomAction (Object customActionObj)
```

Creates an instance from a framework[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object.

This method is only supported on API 21+.

<br />

<br />

|                                                                                        Parameters                                                                                        ||
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `customActionObj` | `Object`: A[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object, or null if none. <br /> |

|                                                                                                                                                                 Returns                                                                                                                                                                  ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction) | An equivalent[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)object, or null if none. <br /> |

### getAction

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String getAction ()
```

Returns the action of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction).

<br />

|                                                                                     Returns                                                                                      ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `String` | The action of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). <br /> |

### getCustomAction

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Object getCustomAction ()
```

Gets the underlying framework[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object.

This method is only supported on API 21+.

<br />

<br />

|                                                                                      Returns                                                                                      ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Object` | An equivalent[PlaybackState.CustomAction](https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html)object, or null if none. <br /> |

### getExtras

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Bundle getExtras ()
```

Returns extras which provide additional application-specific information about the action, or null if none. These arguments are meant to be consumed by a[MediaControllerCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat)if it knows how to handle them.

<br />

|                                                                                                                          Returns                                                                                                                          ||
|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | Optional arguments for the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). <br /> |

### getIcon

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getIcon ()
```

Returns the resource id of the icon in the[Session's](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat)package.

<br />

|                                                                             Returns                                                                              ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | The resource id of the icon in the[Session's](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat)package. <br /> |

### getName

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getName ()
```

Returns the display name of this action. e.g. "Favorite"

<br />

|                                                                                            Returns                                                                                            ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `CharSequence` | The display name of this[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). <br /> |

### toString

```
String toString ()
```

<br />

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

### writeToParcel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void writeToParcel (Parcel dest,
                int flags)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `dest`  | `Parcel` <br /> |
| `flags` | `int` <br />    |

-

  ## Interfaces

  - [MediaSessionCompat.OnActiveChangeListener](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.OnActiveChangeListener)
-

  ## Classes

  - [MediaButtonReceiver](https://developer.android.com/reference/android/support/v4/media/session/MediaButtonReceiver)
  - [MediaControllerCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat)
  - [MediaControllerCompat.Callback](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.Callback)
  - [MediaControllerCompat.PlaybackInfo](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.PlaybackInfo)
  - [MediaControllerCompat.TransportControls](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls)
  - [MediaSessionCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat)
  - [MediaSessionCompat.Callback](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Callback)
  - [MediaSessionCompat.QueueItem](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.QueueItem)
  - [MediaSessionCompat.Token](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token)
  - [ParcelableVolumeInfo](https://developer.android.com/reference/android/support/v4/media/session/ParcelableVolumeInfo)
  - [PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)
  - [PlaybackStateCompat.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder)
  - [PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)
  - [PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder)