# 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
public interface ViewProvider
```

<br />

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

|---|---|
| `https://developer.android.com/reference/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 methods |
|---|---|
| `abstract 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/common/ViewProvider#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. |

## Public methods

### getView

```
abstract 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.

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