If I replace the fragment then their state is lost and their view hierarchy is destroyed, unless it's added to backstack in which case you can't switch between tabs and retain the stack state.
That's the whole point of any custom solution. You basically build your own fragment manager on top of androids own stuff to get the behaviour you want.
Depending on how much you need to retain such a system could even consist of simple separate string lists with info and/or fragment names in them.
Optimal? No. Feasible? Definitely. I wouldn't say it's tricky as much as it's just "annoying" to have to build a custom solution.
View all comments
Show parent comment
1
u/Zhuinden Sep 16 '18
If I replace the fragment then their state is lost and their view hierarchy is destroyed, unless it's added to backstack in which case you can't switch between tabs and retain the stack state.
FragNav might be doing something magical that I am not aware of.