# PlaybackStateCompat.CustomAction

Artifact: [androidx.media:media](https://developer.android.com/jetpack/androidx/releases/media) [View Source](https://cs.android.com/search?q=file:android/support/v4/media/session/PlaybackStateCompat.java+class:android.support.v4.media.session.PlaybackStateCompat.CustomAction) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

*** ** * ** ***


```
public final class PlaybackStateCompat.CustomAction implements Parcelable
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> androidx.media is deprecated. Please migrate to [androidx.media3](https://developer.android.com/media/media3).

`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 `https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder` **This class is deprecated.** Deprecated in Java |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/android/os/Parcelable.Creator.html<https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction>` | `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#CREATOR()` **This field is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `int` | `[describeContents](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#describeContents())()` **This method is deprecated.** Deprecated in Java |
| `static 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))(https://developer.android.com/reference/java/lang/Object.html customActionObj)` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/java/lang/String.html` | `[getAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getAction())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/java/lang/Object.html` | `[getCustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getCustomAction())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/os/Bundle.html` | `[getExtras](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getExtras())()` **This method is deprecated.** Deprecated in Java |
| `int` | `[getIcon](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getIcon())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/java/lang/CharSequence.html` | `[getName](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getName())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/java/lang/String.html` | `[toString](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#toString())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[writeToParcel](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#writeToParcel(android.os.Parcel,int))(https://developer.android.com/reference/android/os/Parcel.html dest, int flags)` **This method is deprecated.** Deprecated in Java |

### Inherited Constants

From [android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) `static final int` `https://developer.android.com/reference/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR = 1`

**This field is deprecated.** Deprecated in Java
`static final int` `https://developer.android.com/reference/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE = 1`

**This field is deprecated.** Deprecated in Java

## Constants

### CREATOR

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static final Parcelable.Creator<PlaybackStateCompat.CustomAction> CREATOR
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

## Public methods

### describeContents

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public int [describeContents](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#describeContents())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### fromCustomAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static PlaybackStateCompat.CustomAction [fromCustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#fromCustomAction(java.lang.Object))(Object customActionObj)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

This method is only supported on API 21+.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html customActionObj` | A `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html` object, or null if none. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction` | An equivalent `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction` object, or null if none. |

### getAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public String [getAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getAction())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns the action of the `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction`.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The action of the `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction`. |

### getCustomAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public Object [getCustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getCustomAction())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the underlying framework `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html` object.

This method is only supported on API 21+.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html` | An equivalent `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html` object, or null if none. |

### getExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public Bundle [getExtras](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getExtras())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | Optional arguments for the `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction`. |

### getIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public int [getIcon](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getIcon())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns the resource id of the icon in the `https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat` package.

| Returns |
|---|---|
| `int` | The resource id of the icon in the `https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat` package. |

### getName

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public CharSequence [getName](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getName())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html` | The display name of this `https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction`. |

### toString

```
public String [toString](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#toString())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### writeToParcel

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public void [writeToParcel](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction#writeToParcel(android.os.Parcel,int))(Parcel dest, int flags)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java