I need to restart the app programmatically. My launcher activity is called 'Login' and after login, the main activity is called 'Main'. From within the main activity I want to restart the app. So I have the following:
Intent i = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
This will show the 'Login' activity, however when I press back I'm returned back to the previous activity.
Is there a better way to really restart the app?