Stop losing UI state on device rotation. Use Android's ViewModel to decouple data from the Activity lifecycle, ensuring complex state persists across configuration changes without manual state saving.
Learn how to choose between remember, rememberSaveable, and ViewModel in Jetpack Compose to ensure your UI state survives rotations and process death without bloating your architecture.
Activities get destroyed on rotation and take your UI state with them. Here's how ViewModel + LiveData fixes that, with a working counter example and three ways to verify the lifecycle behavior yourself.