# PlaybackStateCompat.CustomAction.Builder

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:[Ctors](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction.Builder#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat.CustomAction.Builder#)  

# PlaybackStateCompat.CustomAction.Builder

| 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.Builder
`  
`

extends Object


``


`

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

<br />

*** ** * ** ***

Builder for[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)objects.

## Summary

|                                                                                                                                                                                                                                          ### Public constructors                                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder#PlaybackStateCompat.CustomAction.Builder(java.lang.String, java.lang.CharSequence, int))`(String action, CharSequence name, int icon) ` Creates a[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)builder with the id, name, and icon set. |

|                                                                                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                                                                                        ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)                 | ` `[build](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder#build())`() ` Build and return the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)instance with the specified values.                                                                                |
| ` `[PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder) | ` `[setExtras](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder#setExtras(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Set optional extras for the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). |

| ### 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.Builder#)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() `                    | ||

## Public constructors

### PlaybackStateCompat.CustomAction.Builder

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

```
PlaybackStateCompat.CustomAction.Builder (String action,
                CharSequence name,
                int icon)
```

Creates a[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)builder with the id, name, and icon set.

<br />

|                                                                                                                                                                                                                 Parameters                                                                                                                                                                                                                 ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `action` | `String`: The action of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). <br />                                                                                                                                                                                                                                                 |
| `name`   | `CharSequence`: The display name of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). This name will be displayed along side the action if the UI supports it. <br />                                                                                                                                                            |
| `icon`   | `int`: The icon resource id of the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). This resource id must be in the same package as the[MediaSessionCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat). It will be displayed with the custom action if the UI supports it. <br /> |

## Public methods

### build

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

```
PlaybackStateCompat.CustomAction build ()
```

Build and return the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)instance with the specified values.

<br />

|                                                                                                                                                      Returns                                                                                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction) | A new[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)instance. <br /> |

### setExtras

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

```
PlaybackStateCompat.CustomAction.Builder setExtras (Bundle extras)
```

Set optional extras for the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). These extras 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. Keys should be fully qualified (e.g. "com.example.MY_ARG") to avoid collisions.

<br />

|                                                                                            Parameters                                                                                            ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras` | `Bundle`: Optional extras for the[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction). <br /> |

|                                                                                   Returns                                                                                   ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| [PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder) | this. <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)