是否有可能替换默认"强制关闭"在Android的对话框?有可能、对话框、QUOT、Android

2023-09-04 10:32:37 作者:与泪诀别

我想我的Andr​​oid应用程序的用户有给我发电子邮件任何未捕获异常崩溃我的应用程序的堆栈跟踪的选项。原本我以为我会只是包装每一个切入点,我在try / catch块的应用程序,但也有太多太多,这些即使在我很小的应用程序,这是合理的。

所以,我所真正需要的是一个方法来指定一些方法是默认处理任何未捕获的异常。有什么建议?

解决方案

您不能做的主题行国从SDK应用程序。

不过:   

那么,我期待的是一个   方式来指定一些方法是   默认处理任何未捕获   异常。有什么建议?

使用 Thread.setDefaultUncaughtExceptionHandler()

此外,考虑使用乱舞或DroidDrop或东西你的异常数据的实际交付。

这个系统自带应用一定不要删

I would like the users of my android app to have the option to email me the stacktrace of any uncaught exception that crashes my app. Originally I thought I would just wrap every entry point to my app in a try/catch block, but there are far too many of these even in my tiny app for this to be reasonable.

So what I am really looking for is a way to specify some method to be the default handler for any uncaught exceptions. Any suggestions?

解决方案

You cannot do what the subject line states from an SDK application.

However:

So what I am really looking for is a way to specify some method to be the default handler for any uncaught exceptions. Any suggestions?

Use Thread.setDefaultUncaughtExceptionHandler().

Also, consider using Flurry or DroidDrop or something for the actual delivery of your exception data.