New Libraries in Project Dependencies
After you have created a new TV project using the Android Studio Wizard, you might notice that the wizard has automatically included some libraries in your project dependencies. Yourbuild.gradle file will look like this:
- Leanback: The v17 Leanback Support Library is a standard Android support library focused on providing APIs and widgets to simplify the development of TV apps. Most of the components used in a Leanback-enabled project are contained in this library.
- RecyclerView: This library provides the
RecyclerViewclass. This class is used to display large datasets efficiently recycling views, improving performance, and saving memory. Many of the components of the Leanback Library rely onRecyclerView. TheRecyclerViewimplements a common programming pattern in Android, which is theViewholderpattern. This is important when developing for TV (more info onViewHolderhere). - AppCompat: The main purpose of the AppCompat library is to provide APIs, widgets, and tools across multiple versions of Android. It’s useful to provide your Android application on multiple devices, in particular if you ship your app in a single .apk binary file both for handheld devices and for TV.
- Glide: This is an efficient open source media management and image loading framework for Android. It allows you to efficiently decode, download, and apply images from the cloud. It’s used by some components of the Leanback-enabled app to efficiently fetch thumbnails and images to display previews of the content in the TV app.
The Main Streaming App Interaction Model
The user journey when using a media streaming app is composed of three main steps:
- Browse for content: Users go through the main catalog of media, searching for interesting content to play.
- Read the description and details: When an item has caught users’ interest, they will focus on reading the descriptions and details of the content to decide.
- Play: When the users have found something to watch, they will start playing the content.
The Main Components of a Leanback-Enabled Android App
A Leanback-enabled Android app follows this interaction model. In fact, the three main components of a Leanback-enabled app are the same three main steps of the media streaming app interaction model:
BrowseFragment: Allows you to browse for content in the main app catalog.DetailsFragment: Grants access to extended details for specific content selected in the BrowseFragment and to perform actions like “Play Content.”PlaybackOverlayFragment: This fragment allows you to overlay media controls on a full-screen media player.

