# 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
public final class MediaRouteButtonViewProvider implements 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/androidx/media3/cast/MediaRouteButtonViewProvider#MediaRouteButtonViewProvider()()` |

| ### Public methods |
|---|---|
| `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/androidx/media3/cast/MediaRouteButtonViewProvider#getView(android.view.ViewGroup)(https://developer.android.com/reference/android/view/ViewGroup.html viewGroup)` 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

```
public MediaRouteButtonViewProvider()
```

## Public methods

### getView

```
public ListenableFuture<View> getView(ViewGroup viewGroup)
```

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 |
|---|---|
| `https://developer.android.com/reference/android/view/ViewGroup.html viewGroup` | 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`. |