It seems to me that a very basic functionality, which is to clear back stack, is absent from the FragmentManager API, i am posting this question because i want to know if its just poor design or is there good reasons that i dont yet realize for the following :
I happen to find my self in a situation where i need to clean back stack and start it fresh, there is no proper way of doing it, the only way i am aware of after google searching is this (or alike) :
while (supportFragmentManager.popBackStackImmediate()); supportFragmentManager.beginTransaction().replace(R.id.content, freshStartFragment).commit();
The problem about this is that transactions with animations are being executed on main thread stucking GUI for no reason what so ever
getBackStackEntryAt seemed to be promissing when i was facing problem 1, I thought it is reasonable that actual transaction would be available through a BackStackEntry but unluckily this class seem very redundent
Continuing comment 2, as back stack contains transactions, i would expect a getter for them so i can edit them, for example to make them show no animtaion so that the code in 1 would work well.
To put it in short, Why would i have to go all that way just to clean back stack? What good reason is there for the FragmentManager designer to exclude a simple cleanBackStack method?
Enlighten me :)
NOTE: My question is diffrent then Clear back stack using fragments as i am not asking how (as there are many posts that have answers for that), i am asking why would a simple basic functionality need to be implemented in such a hacky way? the biggest problem (which itself has hacky solutions too) about this hacky solution is that the GUI thread gets stuck while executing the pops...