1

I want to restart my app from internal activity and I saw here that I should this code:

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

The problem is when I use FLAG_ACTIVITY_CLEAR_TOP flag the app exits and doesn't restart. Any suggestions?

Community
  • 1
  • 1
shimiA
  • 233
  • 3
  • 8
  • Follow the below links http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app – Amit Sep 26 '13 at 18:03

1 Answers1

2

In my case, Call to System.exit(0) to close the current activity, solve the problem.

Intent i = getBaseContext().getPackageManager()
             .getLaunchIntentForPackage( getBaseContext().getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
System.exit(0);
shimiA
  • 233
  • 3
  • 8