Intent.FLAG_ACTIVITY_CLEAR_TOP doesn't deletes the activity stack

后端 未结 10 855
遇见更好的自我
遇见更好的自我 2020-12-17 09:20

I am developing the application in which i want to close whole application on button click. I know in android we should not think about to close the application because andr

10条回答
  •  醉梦人生
    2020-12-17 10:04

    Try this:

    Intent intent = new Intent(Activity3.this, FinishActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    finish();
    

提交回复
热议问题