Skip to content
Tagged articles

SavedStateHandle

2 articles · Page 1 of 1
AndroidPub
AndroidPub
Oct 19, 2026 · Mobile Development

Compose State Management: When to Use ViewModel vs remember vs rememberSaveable

The article distinguishes three lifecycle events that reset UI state — recomposition, configuration change, and process death — and maps each to the appropriate Compose state holder (remember, retain, rememberSaveable, ViewModel) with a counter example, showing how to persist user-modified data and enable JVM unit testing.

AndroidJetpack ComposeLifecycle
0 likes · 18 min read
Compose State Management: When to Use ViewModel vs remember vs rememberSaveable
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Dec 5, 2023 · Mobile Development

Understanding Android ViewModel: State Preservation, onRetainNonConfigurationInstance, and Implementation Details

This article explains how Android ViewModel preserves UI state across configuration changes, the role of SavedStateHandle and onRetainNonConfigurationInstance, the internal mechanisms involving ComponentActivity and ViewModelStore, and provides practical guidance on using factories, CreationExtras, and Hilt for custom ViewModel implementations.

AndroidJetpackLifecycle
0 likes · 22 min read
Understanding Android ViewModel: State Preservation, onRetainNonConfigurationInstance, and Implementation Details