# How to programmatically enable or disable audio tracks on Android

This article describes how you can use the AudioTrack API, a sub-API of the MediaTrack API, to enable or disable audio tracks. Implementing this functionality is a common use-case for developers who want to build their own UI to toggle audio languages on and off.

Once you have programmatically selected a track, you can set its `enabled` property (or method) to `true` or `false`. Because only one audio track can play at a time, enabling an audio track automatically disables all other audio tracks. Note that this does not apply to text tracks: multiple text tracks can be active at the same time.

## Usage

The Android SDK exposes the audio tracks through [`player.getAudioTracks()`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/Player#getAudioTracks\(\)), which contains [`MediaTrack`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack) objects with a [`setEnabled`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack#setEnabled\(boolean\)) method.

```kotlin
// enable a specific audio track
player.audioTracks.getItem(indexOfRequestedAudioTrack).isEnabled = true
```

## Related articles

* [How to programmatically detect audio tracks](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/how-to-guides/android/media-tracks/detect-audio-tracks.md)
* [How to programmatically detect audio track changes](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/how-to-guides/android/media-tracks/detect-audio-track-changes.md)
* [How to build a chromeless UI](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/how-to-guides/android/ui/build-chromeless-ui.md)
