[Android]關閉所有Activity 然後開啟某個Activity
阿新 • • 發佈:2019-02-11
private volatile long lastJump = 0;
public void loginAgain(String message){
if(System.currentTimeMillis() - lastJump > 2000) {
lastJump = System.currentTimeMillis();
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
Bundle bundle = new Bundle();
bundle.putBoolean(Constant.INTENT_LOGIN_AGAIN,true);
bundle.putString(Constant.INTENT_LOGIN_MESSAGE,message);
intent.putExtras(bundle);
startActivity(intent);
}
}