开发者

How to prevent application from crash if unhandled exception happened in some child thread

开发者 https://www.devze.com 2023-03-16 05:47 出处:网络
If I do a regular Java application then all exceptions which uncaught, get propagated in main thread and I can catch them here. However I do not see how I can use that in Android application. Let\'s s

If I do a regular Java application then all exceptions which uncaught, get propagated in main thread and I can catch them here. However I do not see how I can use that in Android application. Let's say I have some third party library which uses some JDK 1.6 API and access to these API generates unhandled exception which crashes m开发者_StackOverflow社区y application. Since I do not have direct control of thread creations in third party libraries, I can't use Thread.UncaughtExceptionHandler. So what's way to catch such exception and notify a user without crashing application?


Just set a default exception handler for all threads

0

精彩评论

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