how I can pop specific fragment from stack and remove others from a fragment? for example these are my fragments and I\'m in E right know.
A-> B -> C -> D ->E
<
tldr: try using fragmentManager instead of supportFragmentManager if the code doesn't work
solution: fragmentManager.popBackStackImmediate(tagName, 0)
I know it's an old question but after spending a few hours on this, I wasn't able to get close to the desired result.
I was using supportFragmentManager and the code was:
supportFragmentManager.popBackStackImmediate(tagName, 0)
but it wasn't working as intended neither according to what was written in the documentation. Just as a fluke I thought about using the fragmentManager instead of the supportFragmentManager and voila, it worked!
So for anyone stuck on this, maybe give this a try.