uncaught-exception

Ideal way to set global uncaught exception Handler in Android

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 01:49:21
问题 I want to set a global uncaught exception handler for all the threads in my Android application. So, in my Application subclass I set an implementation of Thread.UncaughtExceptionHandler as default handler for uncaught exceptions. Thread.setDefaultUncaughtExceptionHandler( new DefaultExceptionHandler(this)); In my implementation, I am trying to display an AlertDialog displaying appropriate exception message. However, this doesn\'t seem to work. Whenever, an exception is thrown for any thread

Ideal way to set global uncaught exception Handler in Android

大兔子大兔子 提交于 2019-11-26 01:21:53
I want to set a global uncaught exception handler for all the threads in my Android application. So, in my Application subclass I set an implementation of Thread.UncaughtExceptionHandler as default handler for uncaught exceptions. Thread.setDefaultUncaughtExceptionHandler( new DefaultExceptionHandler(this)); In my implementation, I am trying to display an AlertDialog displaying appropriate exception message. However, this doesn't seem to work. Whenever, an exception is thrown for any thread which goes un-handled, I get the stock, OS-default dialog ("Sorry!-Application-has-stopped-unexpectedly