# 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)

*** ** * ** ***


```
class PlaybackStateCompat.CustomAction : 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/kotlin/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/kotlin/android/support/v4/media/session/MediaControllerCompat`.

## Summary

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

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

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[describeContents](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#describeContents())()` **This function is deprecated.** Deprecated in Java |
| `java-static https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction!` | `[fromCustomAction](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#fromCustomAction(java.lang.Object))(customActionObj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `[getAction](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getAction())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | `[getCustomAction](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getCustomAction())()` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `[getExtras](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getExtras())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getIcon](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getIcon())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!` | `[getName](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getName())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `[toString](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#toString())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[writeToParcel](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#writeToParcel(android.os.Parcel,int))(dest: https://developer.android.com/reference/android/os/Parcel.html!, flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Deprecated in Java |

### Inherited Constants

From [android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR = 1`

**This property is deprecated.** Deprecated in Java
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE = 1`

**This property 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)

```
const val CREATOR: Parcelable.Creator<PlaybackStateCompat.CustomAction!>!
```

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

## Public functions

### 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)

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

> [!CAUTION]
> **This function 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)

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

> [!CAUTION]
> **This function 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 |
|---|---|
| `customActionObj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | A `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction.html` object, or null if none. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction!` | An equivalent `https://developer.android.com/reference/kotlin/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)

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

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

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The action of the `https://developer.android.com/reference/kotlin/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)

```
fun [getCustomAction](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#getCustomAction())(): Any!
```

> [!CAUTION]
> **This function 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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.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)

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

> [!CAUTION]
> **This function 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/kotlin/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/kotlin/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)

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

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

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The resource id of the icon in the `https://developer.android.com/reference/kotlin/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)

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

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

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!` | The display name of this `https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction`. |

### toString

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

> [!CAUTION]
> **This function 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)

```
fun [writeToParcel](https://developer.android.com/reference/kotlin/android/support/v4/media/session/PlaybackStateCompat.CustomAction#writeToParcel(android.os.Parcel,int))(dest: Parcel!, flags: Int): Unit
```

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