Android - Clearing Navigation Backstack

后端 未结 3 1127
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 18:34

I have 4 pages.

From page_1 > page_2 > page_3 > page_4.

Once the user reaches page_3 and clicks a button, it navigates to page_4. Once the button is clicked

3条回答
  •  Happy的楠姐
    2021-01-20 18:56

    Try set Intent.FLAG_ACTIVITY_NO_HISTORY And Intent.FLAG_ACTIVITY_TASK_ON_HOME

    From documentation Intent.FLAG_ACTIVITY_NO_HISTORY

    If set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the noHistory attribute.

    Intent.FLAG_ACTIVITY_TASK_ON_HOME

    If set in an Intent passed to Context.startActivity(), this flag will cause a newly launching task to be placed on top of the current home activity task (if there is one). That is, pressing back from the task will always return the user to home even if that was not the last activity they saw. This can only be used in conjunction with FLAG_ACTIVITY_NEW_TASK.

提交回复
热议问题