Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
A correctly scoped ViewModel survives configuration changes, but not process death. Use saved state for small restorable values and persistent storage for durable data.
Rotation can recreate an Activity while its scoped ViewModel remains available. If Android kills the process, the ViewModel and its in-memory data disappear. SavedStateHandle can restore suitable small values through saved-state mechanisms after system recreation; it is not a durable database. Store important records in persistent storage and use saved identifiers to reload them. Avoid retaining an Activity or View in a long-lived ViewModel.