PlaybackStateCompat.CustomAction.Builder


public final class PlaybackStateCompat.CustomAction.Builder


Builder for CustomAction objects.

Summary

Public constructors

Builder(String action, CharSequence name, int icon)

Creates a CustomAction builder with the id, name, and icon set.

Public methods

PlaybackStateCompat.CustomAction

Build and return the CustomAction instance with the specified values.

PlaybackStateCompat.CustomAction.Builder
setExtras(Bundle extras)

Set optional extras for the CustomAction.

Public constructors

Builder

Added in 1.1.0
public Builder(String action, CharSequence name, int icon)

Creates a CustomAction builder with the id, name, and icon set.

Parameters
String action

The action of the CustomAction.

CharSequence name

The display name of the CustomAction. This name will be displayed along side the action if the UI supports it.

int icon

The icon resource id of the CustomAction. This resource id must be in the same package as the MediaSessionCompat. It will be displayed with the custom action if the UI supports it.

Public methods

build

Added in 1.1.0
public PlaybackStateCompat.CustomAction build()

Build and return the CustomAction instance with the specified values.

setExtras

Added in 1.1.0
public PlaybackStateCompat.CustomAction.Builder setExtras(Bundle extras)

Set optional extras for the CustomAction. These extras are meant to be consumed by a MediaControllerCompat if it knows how to handle them. Keys should be fully qualified (e.g. "com.example.MY_ARG") to avoid collisions.

Parameters
Bundle extras

Optional extras for the CustomAction.

Android Studio provides app builders with an integrated development environment (IDE) optimized for Android apps. Download Android Studio today.

Updated Oct 3, 2024

API reference packages and classes for Android app developers.

Updated Feb 10, 2025

Jetpack Compose is Android's recommended modern toolkit for building native UI. It simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs.

Updated Feb 21, 2025