What is a Jetpack ViewModel and the problem it solves?

This tests your understanding of lifecycle-aware state preservation. A good answer explains that ViewModels survive configuration changes (like rotation) to hold UI data, separating it from the transient UI controller.
This question tests your grasp of Android's lifecycle complexity and how ViewModel provides a robust solution for state preservation. A strong answer defines ViewModel as a class for UI data that outlives Activities/Fragments during configuration changes (e.g., rotation), separating data from the UI controller. It's crucial to contrast its role with the `onSaveInstanceState` mechanism, which handles process death. A common red flag is conflating their distinct purposes.
Read the original → developer.android.com
- #android
- #jetpack
- #viewmodel
- #lifecycle
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.