apply Uncaught Exception Handler - Android java.lang

Android examples for java.lang:Thread

Description

apply Uncaught Exception Handler

Demo Code

import android.content.Context;

public class Main {

  public static final void applyUncaughtExceptionHandler(Context context) {
    // remove for release build
    Thread.setDefaultUncaughtExceptionHandler(new ShowStacktraceUncaughtExceptionHandler());
  }/*from w ww.  j a  va 2  s  .c o m*/

}

class ShowStacktraceUncaughtExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler{

  @Override
  public void uncaughtException(Thread arg0, Throwable arg1) {
    // TODO Auto-generated method stub
    
  }
  
}

Related Tutorials