Android, Intent.FLAG_ACTIVITY_CLEAR_TOP seems doesn't work?

后端 未结 6 595
忘掉有多难
忘掉有多难 2020-12-16 08:25

In my menu I have some items. Home is an item of it that I want to be root of my application and whenever user clicks on it, Android clear stack and then come back to main s

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 08:59

    If you want to start an Activity to be the only one existing (that is, clear the whole backstack), use the following flags:

    Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
    

    Requires API-Level >= 11.

提交回复
热议问题