How to finish every activity on the stack except the first in Android

后端 未结 2 1066
时光取名叫无心
时光取名叫无心 2020-12-15 05:32

I\'m porting an iPhone app to Android and I can\'t seem to find a means to pop each activity on the stack except the root activity.

In objective-c I would do somethi

2条回答
  •  天涯浪人
    2020-12-15 05:54

    Look at http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP: you can startActivity on the root activity with this flag, and it will blow away all activities above it. You should read the docs carefully about the intent delivery behavior.

提交回复
热议问题