To migrate from the Leanback UI toolkit to Compose for Android TV, follow these steps:
-
Assess your current Leanback implementation by identifying the components you're using (including those that are provided inside the prefabricated fragments) and understanding how your UI is structured and how data flows through your app.
-
Migrate individual screens of your TV app to Compose so you can learn and adapt to Compose gradually.
While you can use both Leanback and Compose within the same app to allow for a gradual migration process, begin by replacing entire fragments at a time with a goal of converting your TV application into a single activity.
Start small. Don't try to migrate everything at once. Begin with smaller components like settings or account screens and gradually work your way through the app.
Refer to documentation and examples in the resources listed in the Resources section.
Leverage dedicated components from Compose for TV by using the Jetpack libraries. Consult our design guides to explore how you can customize and extend ready-to-use composables to build beautiful TV UIs.
Adapt your data and state management to support the Compose declarative programming paradigm. Adaptation might require changes in how you manage data and state in your app. Use
ViewModel
and Jetpack Compose internal state management mechanisms to manage data and state in your app.Test and iterate as you migrate more complex parts of your app.
Engage with the active Android developer community on Stack Overflow for any bugs you encounter, or submit the bugs through our public bug tracker.
Resources
Whether you're new to Compose or are in the process of migrating to Compose already, our large collection of resources are here to help you learn best practices for building TV UIs with the modern Android development toolkit, Jetpack Compose:
- Compose for TV integration guides
- TV design guides
- Introduction to Compose for TV codelab
- Library release notes
- JetStream video streaming sample app
- JetCaster audio streaming sample app
- Component samples