I am using a WebView
in my app's sole Activity
. Whenever the user clicks on the BACK button, I override the onKey
and process some clean up before calling finish
of the activity.
I see that once in a while (maybe 1 out of 20 times), onDestroy
is not called. And in this case, if I launch my app again, a blank screen comes up. The Activity's onCreate
is not called, and neither is my overridden Application's onCreate
.
Does anyone know why this happens, and are there any possible solutions?
Thanks,
Rajath
It turns out that I was capturing uncaught exceptions using the UncaughtExceptionHandler()
. So, sometimes when the app was actually crashing in onDestroy()
, the subsequent session was not properly launched.
Of course, in the case where the app's onDestroy()
was not called at all, the problem is still fixed when I don't use UncaughtExceptionHandler()
. Not sure why though.
-Rajath