0

How can I finish all activities and start from main after my application is automatically destroyed and created again? This can happen for example when a user changes a system font. My application class contains the big amount of data which is used by many activities and it gets cleared on app restart, the state becomes invalid, that's why I have to return to the launcher activity and clear all the history.

I tried to call the following code in application's onCreate() method as suggested by Marc here, but it doesn't work:

Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage( getBaseContext().getPackageName() );
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
Community
  • 1
  • 1
user1031477
  • 63
  • 1
  • 4

1 Answers1

0

Just Add Finish() method after starting each activity through your Intent..

SRam
  • 2,832
  • 4
  • 45
  • 72