I want to handle the crashes smoothly ,for that i am restarting the app for every uncaught exceptions but there is always alert box is there "unfortunately ,xyz has stopped working" code that i am using to handle uncaught exceptions :
intent = PendingIntent.getActivity(this.getApplication().getBaseContext(), 0,
new Intent(getIntent()), getIntent().getFlags());
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread paramThread,
Throwable paramThrowable) {
Log.e("Alert", "Lets See if it Works !!!");
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 2000, intent);
System.exit(0);
}
@Override
public void uncaughtException(Thread paramThread,
Throwable paramThrowable) {
Log.e("Alert", "Restarting app !!!");
Intent intent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage( getBaseContext().getPac
//i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTI
startActivity(intent);
System.exit(2);
}
});