Android : Application hanging when trying to start a specific activity after uncaught exception

on Saturday, October 11, 2014


I have following code to handle any uncaught exceptions and re-start the application from the Splash screen as there are a whole bunch of initilizations that I do in the Splash Screen. This is my launch screen.


Now I have the following code to this effect:



@Override
public void uncaughtException(Thread thread, Throwable ex) {
// restart Application
Log.e("OSRAM Lightify", "LightifyApplication: UNCAUGHT EXCEPTION FOUND: \n" + ex.getStackTrace());

Intent reStartIntent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage(getBaseContext().getPackageName());
reStartIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(reStartIntent);


}


But is hangs at startActivity(reStartIntent); and screen goes blank.


Could some one please help me understand as to what is going on here?


0 comments:

Post a Comment