开发者

Do not close the application after a crash

开发者 https://www.devze.com 2023-02-16 00:04 出处:网络
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 conti

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消