Questions tagged «uncaught-exception»

5
在Android中设置全局未捕获异常处理程序的理想方法
我想为我的Android应用程序中的所有线程设置全局未捕获的异常处理程序。因此,在Application子类中,我将未实现的Thread.UncaughtExceptionHandler异常的实现设置为默认处理程序。 Thread.setDefaultUncaughtExceptionHandler( new DefaultExceptionHandler(this)); 在我的实现中,我试图显示一条AlertDialog显示适当的异常消息。 但是,这似乎不起作用。无论何时,任何未处理的线程都会引发异常,我得到了库存的OS默认对话框(“抱歉!-应用程序已停止-意外对话框”)。 为未捕获的异常设置默认处理程序的正确理想方法是什么?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.