# ViewProvider

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

*** ** * ** ***

<br />

```
@UnstableApi
interface ViewProvider
```

<br />

Known direct subclasses [MediaRouteButtonViewProvider](https://developer.android.com/reference/kotlin/androidx/media3/cast/MediaRouteButtonViewProvider)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/cast/MediaRouteButtonViewProvider` | A provider of a media route button view to be displayed in the player UI. |

*** ** * ** ***

Provider of a view to be displayed in the player UI.

## Summary

| ### 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/common/ViewProvider#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. |

## 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.

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

The callback of the returned `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` may be called on a different thread than the caller's thread. If the caller wants to update the UI in the callbacks, it is responsible for forwarding the callback to the UI thread.

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