Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for CustomAction
objects.
Summary
Public constructors |
Creates a CustomAction builder with the id, name, and icon set.
|
Public constructors
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PlaybackState.CustomAction.Builder\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/session/PlaybackState.CustomAction.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|---------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.session.PlaybackState.CustomAction.Builder](#) |\n\nBuilder for [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(kotlin.String,%20kotlin.CharSequence,%20kotlin.Int))`(`action:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `name:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `icon:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Creates a [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) builder with the id, name, and icon set. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [PlaybackState.CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction)! | [build](#build())`()` Build and return the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) instance with the specified values. |\n| [PlaybackState.CustomAction.Builder](#)! | [setExtras](#setExtras(android.os.Bundle))`(`extras:` `[Bundle](../../os/Bundle.html#)!`)` Set optional extras for the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(\n action: String!, \n name: CharSequence!, \n icon: Int)\n```\n\nCreates a [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) builder with the id, name, and icon set.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `action` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The action of the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). |\n| `name` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: The display name of the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). This name will be displayed along side the action if the UI supports it. |\n| `icon` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The icon resource id of the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). This resource id must be in the same package as the [MediaSession](/reference/kotlin/android/media/session/MediaSession). It will be displayed with the custom action if the UI supports it. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): PlaybackState.CustomAction!\n```\n\nBuild and return the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) instance with the specified values.\n\n| Return ||\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|\n| [PlaybackState.CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction)! | A new [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction) instance. |\n\n### setExtras\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setExtras(extras: Bundle!): PlaybackState.CustomAction.Builder!\n```\n\nSet optional extras for the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). These extras are meant to be consumed by a [MediaController](/reference/kotlin/android/media/session/MediaController) if it knows how to handle them. Keys should be fully qualified (e.g. \"com.example.MY_ARG\") to avoid collisions.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `extras` | [Bundle](../../os/Bundle.html#)!: Optional extras for the [CustomAction](/reference/kotlin/android/media/session/PlaybackState.CustomAction). |\n\n| Return ||\n|------------------------------------------|-------|\n| [PlaybackState.CustomAction.Builder](#)! | this. |"]]