android-lifecycle icon indicating copy to clipboard operation
android-lifecycle copied to clipboard

onSaveInstanceState() vs onRestoreInstanceState()

Open aicaprio opened this issue 10 years ago • 1 comments

onSaveInstanceState() will be called anytime before onStop() . onRestoreInstanceState() only will be called when the activity is actually been rescycled.

aicaprio avatar Mar 03 '15 04:03 aicaprio

1/ Documentation claims onSaveInstanceState will occur (if ever) before onStop, not onDestroy. I think you are right. http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState%28android.os.Bundle%29

2/ Not only onRestoreInstanceState as you mention but onSaveInstanceState are both conditional; which is shown in the diagram. I don't see an issue here.

defHLT avatar Mar 03 '15 23:03 defHLT