Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ActivityExceptionHandlerimplements Thread.UncaughtExceptionHandler {
- private final Context mContext;
- public ActivityExceptionHandler(Context context) {
- mContext = context;
- }
- @Override
- public void uncaughtException(Thread t, Throwable e) {
- // logging code
- ...
- ...
- // show error UI
- Intent intent = new Intent(mContext, GenericErrorActivity.class);
- intent.putExtra("error", e.toString());
- mContext.startActivity(intent);
- android.os.Process.killProcess(android.os.Process.myPid());
- System.exit(0);
- }
- }
- Thread.setDefaultUncaughtExceptionHandler(new ActivityExceptionHandler(this));
Add Comment
Please, Sign In to add comment