如何开始从UncaughtExceptionHandler的活动,如果这是主线程崩溃? [英] How to start activity from UncaughtExceptionHandler if this is main thread crashed?

查看:337
本文介绍了如何开始从UncaughtExceptionHandler的活动,如果这是主线程崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图启动错误报告activty如果未处理的异常检测。问题是与主线程抛出的异常。有没有什么办法可以开始活动,如果主线程崩溃?

I am trying to start an error-reporting activty if unhandled exception detected. The problem is with exceptions thrown from main thread. Is there any way to start an activity if main thread crashed?

推荐答案

我已经看到了用于错误捕获在一个<一的方法href="http://d.android.com/reference/java/lang/Thread.UncaughtExceptionHandler.html"><$c$c>UncaughtExcpetionHandler是写碰撞数据到文件,然后启动错误处理活动当应用程序是基于碰撞数据文件的存在,重新开始。

The approach I've seen used for error catching in an UncaughtExcpetionHandler is to write the crash data out to file and then start the error handling Activity when the application is restarted based on the existence of the crash data file.

根据你希望你的活动做的,这可能为你工作。

Depending on what you want your Activity to do, this might work for you.

这篇关于如何开始从UncaughtExceptionHandler的活动,如果这是主线程崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆