DEV Community

Cover image for Don't think Viewmodel will replace SaveInstanceState

Don't think Viewmodel will replace SaveInstanceState

Randy Arba on November 09, 2019

Different Capabilities Maybe some developer will excited about the ViewModel when it can save the state, and someone will thinking to re...
Collapse
 
funkymuse profile image
FunkyMuse

Viewmodel has save instance state already.

developer.android.com/reference/an...

Collapse
 
leviaran profile image
Randy Arba

Yes true, but this save/load state only trigger when activty/fragmenst still alive.

Collapse
 
funkymuse profile image
FunkyMuse • Edited

It's bound to the fragment so the view model gets new instance if not instantiated already when fragment is recreated