rememberSaveable Across Rotation
Keep state through configuration changes.
The Rotation Problem
Rotate the screen and your tap counter snaps back to zero. That is because a configuration change recreates the whole Activity.
remember Isn't Enough
remember survives recomposition, but not Activity recreation. When the Activity restarts, remembered state is gone for good.
All lessons in this course
- remember & mutableStateOf
- Recomposition: What Triggers a Redraw
- Build a Tap Counter
- rememberSaveable Across Rotation