Do not close the application after a crash
So I would like to know if it is possible to not close the application after a crash. I am doing开发者_如何学JAVA testing on Android applications and I would like the code that would allow me to continue my test when there is a crash
Depends on the crash. Everything I can think of you can catch an exception, log it, and keep going.
The app (usually just the top Activity) can't continue after a crash.
The best you can do is use the standard Java try/catch blocks.
You can recover from a crash using Thread.setDefaultUncaughtExceptionHandler()
. Just replace the default handler with yours (using that method) and do what you want.
精彩评论