简体   繁体   English

在Android中崩溃后开始活动

[英]Start activity after crash in android

I have a question: which activity is running when application crash? 我有一个问题:应用程序崩溃时正在运行哪个活动? First from stack? 首先从堆栈? This is any way to catch that and start activity which I want after crash? 这是捕捉故障并在崩溃后开始我想要的活动的任何方式吗? Maybe is any way to start activity after crash on my own way. 也许是我自己崩溃后开始活动的任何方式。

Android ANR dialog is a System Handled (Generated) you don't have a any control over it.. Android ANR对话框是系统处理的(生成的),您对此没有任何控制权。

As its implemented in System OS Source So you can't change the ANR Dialog. 由于它是在System OS Source中实现的,因此您无法更改ANR对话框。 As you can't catch when ANR comes. 正如您无法及时了解ANR。

The only option is modifying the Android OS Source. 唯一的选择是修改Android OS源代码。

try launching and intent from a try and catch loop.if your code fails in the try block the intent from the catch block should be launched automatically. 从try和catch循环尝试启动和意图。如果您的代码在try块中失败,则catch块的意图应自动启动。

try{
   //faulty code here.
  }catch(Exception e){
   Intent i=new Intent(currentactivity.this,yournextactivity.class);
   startActivity(i);
   }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM