what is the right way to clear background activity/activites from stack?

后端 未结 3 1476
旧时难觅i
旧时难觅i 2021-01-07 00:30

as the questions title says - I need to know what is the best way to \"remove\"/destroy/finish an activity that are somewhere in the middle of stack and currently on pause

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-07 00:51

        Intent myintent = new Intent(YourCurrentActivity.this, YourNextActivitys.class);
        myintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(myintent);
        finish();
    

    I think this is the right way to clear all previous activities...

提交回复
热议问题