If the remote control uses bluetooth control, then if the battery is removed / inserted into the remote control, the following events occur: onPause()
-> onSaveInstanceState()
-> onCreate()
-> onStart()
-> onRestoreInstanceState()
-> onResume()
. The application restarts rather than restoring its previous state. The application behaves as if it was hidden, the device ran out of RAM, so the application was destroyed, and then launched as for the first time.
The onSaveInstanceState()
event is called, can it be used? My main object is a WebView
. Since the app is being destroyed, WebView = null
...
What can be done in this situation? I need batteries to not have that much power over my application. For the application to restore its state, or ignore the power of the batteries.