2017-08-24 37 views

回答

1

该消息为系统消息,它的应用范围之内,所以没有你不能改变它

2

不能由@Nuno戈麦斯说改变系统的消息,但可以有效抑制原消息并自行显示消息或开始一些活动。

可以定义捕捉的应用类中的所有捕获的异常的的ExceptionHandler,并从那里

public class MyApp extends Application implements Thread.UncaughtExceptionHandler { 
    private Thread.UncaughtExceptionHandler mPreviousUncaughtExceptionHandler; 
    @Override public void onCreate() { 
     super.onCreate(); 
     mPreviousUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); 
     Thread.setDefaultUncaughtExceptionHandler(this); 
    } 

    @Override 
    public void uncaughtException(Thread thread, Throwable ex) { 
     try { 
      // Do your stuff with the exception 
      Log.e(Global.LOG_CONTEXT,"LogCat.uncaughtException " + ex, ex); 
      // show user defined messagebox 

     } catch (Exception e) { 
      /* Ignore */ 
     } finally { 
      // uncomment this to let Android show the default error dialog 
      // mPreviousUncaughtExceptionHandler.uncaughtException(thread, ex); 
     } 
    } 

} 

显示一个消息框,应用程序必须在清单

<manifest ...> 

    ... 

    <application 
     android:name=".MyApp" ...> 
    </application> 
</manifest> 

在我android-声明4.4我用这段代码写出一个chrash日志文件