# How to programmatically select a video track quality on Android

This article describes how you can use the VideoTrack API, a sub-API of the MediaTrack API, to select a video track quality. If you select a specific quality, you overrule the ABR algorithm.

Implementing this functionality is a common use-case for developers who want to build their own UI to toggle a specific video quality.

## Usage

Set the [`targetQuality`](https://optiview.dolby.com/docs/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack#setTargetQuality\(Q\)) or [`targetQualities`](https://optiview.dolby.com/docs/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack#setTargetQualities\(java.util.List\)) of a [`MediaTrack`](https://optiview.dolby.com/docs/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack).

```kotlin
val videoTrack = player.videoTracks.getItem(0)

// enable a specific video track quality
videoTrack.targetQuality = videoTrack.qualities.getItem(indexOfRequestedVideoTrackQuality)

// do ABR on a set of qualities:
// the ABR algorithm only selects qualities belonging to the given list
videoTrack.targetQualities = listOf(
    videoTrack.qualities.getItem(0),
    videoTrack.qualities.getItem(1),
)

// set to default ABR algorithm
videoTrack.targetQualities = emptyList()
```

## Related articles

* [How to programmatically detect video track qualities](https://optiview.dolby.com/docs/theoplayer/how-to-guides/android/media-tracks/detect-video-track-qualities.md)
* [How to programmatically detect video track quality changes](https://optiview.dolby.com/docs/theoplayer/how-to-guides/android/media-tracks/detect-video-track-quality-changes.md)
* [How to reduce data usage on mobile devices](https://optiview.dolby.com/docs/theoplayer/how-to-guides/android/media-tracks/reduce-data-usage.md)
* [How to build a chromeless UI](https://optiview.dolby.com/docs/theoplayer/how-to-guides/android/ui/build-chromeless-ui.md)
