android-lifecycle
android-lifecycle copied to clipboard
onSaveInstnceState will not always be called
http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState%28android.os.Bundle%29
in a nutshell, it won't always get called, for fragment pop it in and out from the backstack won't call it.
it will only get called if the activity is going to be destroyed and it knows about it in advance... (so orientation change - yes, opening another app then closing it - no)
Good point. Perhaps it could have a better note about it not being a standard lifecycle method.
A point to mention is how the behaviour changes with onSaveInstanceState()
and setRetainedInstance()
. See https://stackoverflow.com/questions/13420448/how-i-can-break-things-with-fragments-with-setretaininstancetrue-and-adding-th