First, I have two activities: Splash and MainActivity ( only support portrait). In MainActivity, I have many fragments use Slide menu. I want to keep current fragment when u
Issue has been fixed by using FLAG_ACTIVITY_NEW_TASK
when navigate from Splash to Main activity. I just wonder why it can work in debug mode (Reproduce install from apk like release mode). Here is my workable code for anyone has same issues:
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
finish();
startActivity(intent);
Update: many thanks to David Wasser
, so the right answer should like this:
// SplashActivity
if(!isTaskRoot()) {
finish();
return;
}
Reference: Re-launch of Activity on Home button, but...only the first time