开发者

Android: Remove ALL FragmentTransactions from the back stack

I add a bunch of FragmentTransactions to th开发者_JS百科e back stack in one Tab, and I want to clear them ALL from the back stack when the user selects a different Tab. I can't find a method to clear stuff off the back stack, only methods to pop them off, and these don't even return the Fragment to you so you can close them. Any ideas?


If you add many Fragments to the backstack and want to remove them all you can do this: popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)


Just remove them from the backstack using the popBackStack() methods.

Each fragment you pop is exactly the same as if the user had pressed the BACK button, and you don't do any special cleanup when the BACK button is pressed, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜