# CommandButton.DisplayConstraints

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/CommandButton.java+class:androidx.media3.session.CommandButton.DisplayConstraints)

*** ** * ** ***

<br />

```
@UnstableApi
public final class CommandButton.DisplayConstraints
```

<br />

*** ** * ** ***

Constraints for displaying a list of `https://developer.android.com/reference/androidx/media3/session/CommandButton` instances with utilities to resolve these constraints for a given list of buttons.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints.Builder` A builder for `https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints`. |

| ### Public methods |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/session/CommandButton>` | `https://developer.android.com/reference/androidx/media3/session/CommandButton.DisplayConstraints#resolve(java.util.List<androidx.media3.session.CommandButton>,androidx.media3.common.Player)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/session/CommandButton> mediaButtonPreferences, https://developer.android.com/reference/androidx/media3/common/Player player)` Resolves a list of `https://developer.android.com/reference/androidx/media3/session/MediaController#getMediaButtonPreferences()` according to these display constraints and returns the list of buttons to be displayed. |

## Public methods

### resolve

```
public ImmutableList<CommandButton> resolve(List<CommandButton> mediaButtonPreferences, Player player)
```

Resolves a list of `https://developer.android.com/reference/androidx/media3/session/MediaController#getMediaButtonPreferences()` according to these display constraints and returns the list of buttons to be displayed.

Note that the result of this resolution can change whenever the ` mediaButtonPreferences` change, or the `player` reports any of the following listener events:

- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_AVAILABLE_COMMANDS_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAY_WHEN_READY_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_STATE_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_STATE_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SEEK_BACK_INCREMENT_CHANGED()`
- `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SEEK_FORWARD_INCREMENT_CHANGED()`

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/session/CommandButton> mediaButtonPreferences` | The list of `https://developer.android.com/reference/androidx/media3/session/MediaController#getMediaButtonPreferences()`. |
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` used to determine default buttons for empty slots. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/session/CommandButton>` | The resolved list of `https://developer.android.com/reference/androidx/media3/session/CommandButton` to be displayed. Each button will have a single `https://developer.android.com/reference/androidx/media3/session/CommandButton#slots()` defined. |