简体   繁体   中英

Android onRestoreInstanceState(Bundle savedInstanceState)


In my application during normal operation the onRestoreInstanceStatance function is executed and causes a null pointer exception in some listener, without invoking that listener. My app contains a lot of data that I write to a file in onPause and restore in onResume and onRestoreInstanceStatance. How can I make the app stable?

Make sure you assign listeners in the end of the onResume , that will ensure no listeners are fired BEFORE the initial state is set. Then in onPause first thing to do is to remove listeners.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM