Created
February 27, 2017 11:27
-
-
Save anry200/f0e82f0a9ef079a853d411e8bf9e8fa9 to your computer and use it in GitHub Desktop.
Disable animation when starting LoginActivity from another activity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
//Disable start animation | |
overridePendingTransition(0, 0); | |
getWindow().setWindowAnimations(0); | |
super.onCreate(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
if (!userManager.isLoggedIn()) { | |
startLoginActivityAndFinishCurrent() | |
} | |
super.onCreate(); | |
} | |
private startLoginActivityAndFinishCurrent() { | |
Intent intent = new Intent(); | |
intent.setClass(this, LoginFormActivity.class); | |
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); | |
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); | |
startActivity(intent); | |
//disable "finish" animation, should be called after startActivity | |
overridePendingTransition(0, 0); | |
finish(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment