Docs describes when onRestoreInstanceState
IS called:
This method is called after
onStart()
when the activity is being re-initialized from a previously saved state, given here in savedInstanceState. (...) This method is called betweenonStart()
andonPostCreate(Bundle)
. This method is called only when recreating an activity; the method isn't invoked ifonStart()
is called for any other reason .
I'm super curious what does " onStart()
is called for any other reason " mean in context of onRestoreInstanceState
?
The normal lifecycle of an Activity
looks like this:
The lifecycle callbacks between onStart()
and onStop()
can occur over and over again if the Activity
is completely obscured by another Activity
. In this case, onStop()
is called when the Activity
is completely obscured by another Activity
. When the Activity
is made visible again, onStart()
will be called without onRestoreInstanceState()
being called because the Activity
is not being recreated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.