Callback Before Force Close Of Android Activity?
I'd like to have some emergency cleanup code execute just before my app crashes. I tried using onDestroy(),, onFinal() and finalize() to no avail. Is this possible in an Android Ac
Solution 1:
Well, I would recommend not having your app crash in the first place. If there's something that COULD crash, just put a try/catch around it and handle it properly.
Or, as some sort of global try/catch, you can use Thread.setUncaughtExceptionHandler()
. Finally, you could even consider Runtime.addShutdownHook
, but that's most likely a bad idea.
Post a Comment for "Callback Before Force Close Of Android Activity?"