I have an activity that is called at runtime in an Android App. When the user clicks the back button the Activity is destroyed and I overrode the onSaveInstanceState
method to save outState
to be retrieved in a second time but onSaveInstanceState
is never called when the user clicks the back button.
Do you know why this hap开发者_开发技巧pens?
onSaveInstanceState()
is not supposed to be called when the user presses BACK.
It will be called when the user changes configuration (e.g., rotates the screen), if Android believes that the activity is at risk of being destroyed while still being reachable on the stack, and perhaps a few other cases.
精彩评论