Reputation: 513
I`ve faced that Activity lifecycle issue:
AfteronPause()
Activity sets partially visible, than calls onSavedInstanceState(Bundle)
, but when Activity sets to visible again calls justonResume()
method.
The question is why callsonSavedInstanceState(Bundle)
,if i can't get saved state Bundle in onResume()
oronRestoreInstanceState(Bundle)
(becauseonRestoreInstanceState(Bundle)
is not called)?
Upvotes: 1
Views: 3812
Reputation: 3760
There is no guarantee that life-cycle methods after onPause()
will be called but You may be sure all methods before onResume()
will be if Activity
is created/recreated. If only onResume()
is called Activity
was not destroyed/stopped and its state wasn't lost so You don't have to restore it.
As you can read in documentation about restoring state, onRestoreInstanceState()
is called only if Activity
was destroyed and after onStart()
.
Upvotes: 1