onSaveInstanceState when click back button in Android

Hello 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 override the onSaveInstanceState method to save outState to be retrieved in a second time but onSaveInstanceState is never called when the user click the back button.

Do you know why this happens?

Thanks in advance


onSaveInstanceState() is not supposed to be called when the user presses BACK.

It will be called when the user changes configuration (eg, 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.

链接地址: http://www.djcxy.com/p/31900.html

上一篇: 一劳永逸,如何正确地将Fragments的实例状态保存在回栈中?

下一篇: onSaveInstanceState在Android中单击后退按钮时