xxv / android-lifecycle

A diagram of the Android Activity / Fragment lifecycle
5.26k stars 681 forks source link

onSaveInstanceState() vs onRestoreInstanceState() #18

Open aicaprio opened 9 years ago

aicaprio commented 9 years ago

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

defHLT commented 9 years ago

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.