When ViewModels Go to Die: Saving ViewModel State

Sumayyah Ahmed

Android Engineer

Comcast

Contrary to our hopes, ViewModel lifecycles are not infallible. The Android OS can kill running processes, which means killing your ViewModel and all the state that you’ve saved in it, spelling impending disaster for your Activity or Fragment. Luckily, we have a new tool to maintain a seamless user experience even through process death – SavedStateHandle. This talk will use code examples to demonstrate:
• How to use SavedStateHandle to gracefully save and resurrect your ViewModel state through process death
• How to leverage Jetpack to automate state restoration with SavingStateLiveData

Sumayyah has been an Android engineer for 6 years, and has worked at both startups and large corporations. She originally comes from California but is now becoming a Philadelphian.

droidcon Americas is produced by:

Mobile Seasons GmbH (droidcon Global HQ)

Messedamm 22

14055, Berlin

Germany

.droidcon is a registered Trademark of Mobile Seasons GmbH

  • dc-social
  • Twitter - White Circle
  • Facebook - White Circle