Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
Created October 28, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diaolizhi/2ba31b780ee45fa392b90428846e7c12 to your computer and use it in GitHub Desktop.
Save diaolizhi/2ba31b780ee45fa392b90428846e7c12 to your computer and use it in GitHub Desktop.
Android 跳转到一个 Activity 前清空 Activity 栈
btnFinish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentToFinish = new Intent(WizardThree.this, FinishActivity.class);
//重点是下面这一句
intentToFinish.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intentToFinish.putExtra("setting", setting);
startActivity(intentToFinish);
WizardThree.this.finish();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment