# MediaRouteButtonViewProvider

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

*** ** * ** ***

<br />

```
@UnstableApi
class MediaRouteButtonViewProvider : ViewProvider
```

<br />

*** ** * ** ***

A provider of a media route button view to be displayed in the player UI.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/cast/MediaRouteButtonViewProvider#MediaRouteButtonViewProvider()()` |

| ### Public functions |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/android/view/View.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/cast/MediaRouteButtonViewProvider#getView(android.view.ViewGroup)(viewGroup: https://developer.android.com/reference/android/view/ViewGroup.html!)` Returns a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` with the view of a media route button. |

## Public constructors

### MediaRouteButtonViewProvider

```
MediaRouteButtonViewProvider()
```

## Public functions

### getView

```
fun getView(viewGroup: ViewGroup!): ListenableFuture<View!>!
```

Returns a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` with the view of a media route button.

If a media route button cannot be provided, the future may fail with an exception. Consumers should handle the failure gracefully, for example by not showing the media route button.

Clicking on the media route button opens a dialog that allows the user to select a remote device for transferring media.

| Parameters |
|---|---|
| `viewGroup: https://developer.android.com/reference/android/view/ViewGroup.html!` | The parent `https://developer.android.com/reference/android/view/ViewGroup.html` into which the returned view will be inserted. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/android/view/View.html!>!` | A `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that will resolve to the media route button `https://developer.android.com/reference/android/view/View.html`. |