开始在uncaughtException活动()调用 [英] starting activity on uncaughtException() call

查看:327
本文介绍了开始在uncaughtException活动()调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的的UncaughtExceptionHandler 出现未捕获的异常时,启动一个新的活动。这可能吗?

I want to start a new activity from my UncaughtExceptionHandler when an uncaught exception appears. Is this possible?

我认为目前的活动不能开始在其错误状态,一个新的子活动,因为我总是得到这样的错误:

I think the current activity can't start a new child activity in its "error" state because I always get this errors:

07-14 14:34:06.075: INFO/ActivityManager(74): Starting activity: Intent { flg=0x10000000 cmp=de.rwth/system.ErrorHandler (has extras) }
07-14 14:34:06.615: WARN/ActivityManager(74): Activity pause timeout for HistoryRecord{4338f8d8 de.rwth/.main}
07-14 14:34:16.115: WARN/ActivityManager(74): Launch timeout has expired, giving up wake lock!
07-14 14:34:16.628: WARN/ActivityManager(74): Activity idle timeout for HistoryRecord{433a89d8 de.rwth/system.ErrorHandler}

我试着从一个新的线程启动子活动,因为我认为当前线程可能的状态下,不允许开始新的活动,但并没有工作过。

I tried to start the child activity from a new thread, because i thought the current thread might be in a state where it is not allowed to start a new activity but this didn't work too.

因此​​,没有人知道这到底是怎么工作的? 我如何prevent当前活动堵塞一切,而在这种错误状态?是什么办法来设置例外处理?

So does anyone know how this could work? How do i prevent the current activity from blocking everything while in this error state? is the any way to set the exception to handled?

推荐答案

你将需要做的是指定的异常显示活动在清单文件,并设置安卓taskAffinity 安卓过程来的值​​从主过程中的不同。然后,你需要指定href="http://developer.android.com/guide/topics/manifest/intent-filter-element.html" rel="nofollow">意图过滤器的

What you will need to do is specify your exception display Activity in your manifest file and set android:taskAffinity and android:process to values different from your main process. Then you'll need to specify an intent filter and use that to start the activity and pass the data.

默认情况下,taskAffinity从主&LT inheried / code>标记。你可能想是这样安卓taskAffinity =org.example.package.TASK.ExceptionDisplay

By default the taskAffinity is inheried from the main <application> tag and is the same page name set in the <manifest> tag. You probably want something like android:taskAffinity="org.example.package.TASK.ExceptionDisplay"

在默认情况下一切都在一个&lt;应用&GT; 标记在同一个进程中运行。您可以更改使用安卓过程属性你可能要像安卓程序=:exception_process

By default everything in one <application> tag runs in the same process. You can change that using the android:process attribute you probably want something like android:process=":exception_process".

查看更多详情这个文档

这篇关于开始在uncaughtException活动()调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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