What happens to an Activity and its text on screen rotation?

Tests understanding of configuration changes and state preservation. A great answer explains the Activity is destroyed and recreated, `EditText` state is often saved automatically, but the robust solution is using a `ViewModel` with `SavedStateHandle`.
This tests your understanding of the Android Activity lifecycle during configuration changes. A great answer first explains that the Activity is destroyed and recreated. It then notes that `EditText` with an ID often saves its own state automatically. The correct, modern approach is to use a `ViewModel` with `SavedStateHandle` to survive the recreation, while the older method involves manually overriding `onSaveInstanceState()`. A red flag is not knowing that ViewModels survive this process.
Read the original → developer.android.com
- #android
- #activity lifecycle
- #viewmodel
- #state management
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.