How do you save UI state during screen rotation?

Tests your grasp of the Activity lifecycle and state restoration. A great answer explains the destroy/recreate cycle, notes that EditText handles its own state via its ID, and contrasts the modern ViewModel + SavedStateHandle with the older…
This tests your grasp of the Activity lifecycle during configuration changes and modern state restoration patterns. A great answer explains that rotation destroys and recreates the Activity, then notes an EditText with an ID handles its own state. For other UI state, the best practice is using a ViewModel with SavedStateHandle to survive configuration changes and process death, contrasting it with the older onSaveInstanceState method. A red flag is suggesting only onSaveInstanceState or disabling rotation.
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.