Android remove Activity from back stack

后端 未结 11 2080
予麋鹿
予麋鹿 2020-12-07 17:23

Okay so I\'m kind of stumped on what to do with this. So I have the MainActivity, and from there an Activity can be launched to DegreePlanActivity, and from there another Ac

11条回答
  •  猫巷女王i
    2020-12-07 17:58

    You can call finish before you start your new activity. This will remove the current activity from the stack, so when you press back button from the next activity, the first activity will not be called from the stack history.

    Intent i = new Intent(MainActivity.this, NextActivity.class);
    finish();  
    startActivity(i);
    

提交回复
热议问题