質問

Hi I am developing android application in which I am using fragments and push to back stack. So my scenario is like this I have fragment A, B, C, D and I push them in following sequence A-->B-->C-->D and what I want I want to remove D and C and bring B on top. Is there any way to remove all together and bring one particular fragment on top of the stack. like pop from back stack upto xyz fragment tag. Is there any way to do this. Need help thank you.

役に立ちましたか?

解決

You want this: FragmentManager.popBackStack(int id, int flags)

You need to save the value returned by FragmentTransaction.commit() of the transaction that adds Fragment B. Then later call getFragmentManager().popBackStack(commitId, 0);

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top