Skip to content

MediumConceptAndroid in depth

What is the ViewModel and why does it survive configuration changes?

What a good answer covers

A ViewModel holds UI state and is retained across configuration changes such as rotation because it is scoped to a lifecycle owner that outlives the recreated Activity, and it is cleared when the owner is finished.

More on Android in depth

Flashcards for this topic