How to save transient states in activity life cycle? eg: If I am using some variables, which will change based on my activities life cycle, then where should I save those variables, in case of configuration changes?
Save all those variables in onSaveInstanceState().
Save it using onRetainNonConfigurationInstance function.
Save those variables in onPause.
Android will save & restore all these variables, so programmer don't need to worry.
These kind of variables are called as transient state of Activity. These will not be saved by Android, it is programmers duty. So save it in onSaveInstanceState().
Back To Top