Activity Be Killed When Press Home Only In Release Mode
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 user lea
Solution 1:
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 = newIntent(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:
// SplashActivityif(!isTaskRoot()) {
finish();
return;
}
Reference: Re-launch of Activity on Home button, but...only the first time
Post a Comment for "Activity Be Killed When Press Home Only In Release Mode"