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 my 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?
Asked
Active
Viewed 1,857 times
1 Answers
3
Just set a default exception handler for all threads

mibollma
- 14,959
- 6
- 52
- 69
-
1This isn't guaranteed to work. It is possible for the `ThreadGroup` containing the third party thread to catch the error and call `System.exit()` (or whatever the Android equivalent is). – Jun 29 '11 at 05:39
-
True. But that's just very bad library design. – mibollma Jun 29 '11 at 12:08