I'm trying to wrap my head around how and where i should be setting up my fragments.
Use case senario i'm trying to implement
- I have a mainActivity that has a
bottomNigationViewwidget that will open different fragments (fragment A, B and C) - In FragmentB i ask the user to input some information, then they click the
nextbutton which should should load another fragment lets say called FragmentB2 - FragmentB2 should carry over some information that the user imputed from FragmentB
My question is, should i be making the fragment transactions of both fragments B and B2 in the mainActivity? Since i read online that it's not good practice to have nested fragments.
Currently, what i have is inside of FragmentB, i start a fragment transactions when the next button is clicked, so that it creates and goes to FragmentB2. I think this is whats called a nested Fragment, correct?
If you're near the beginning of your project, this is a great time to look into using a navigation controller from google's new architecture components.
https://developer.android.com/topic/libraries/architecture/navigation/
This will let you abstract the management of these individual stacks of fragments. I know this is a bit of a tangential response, but if you are worried about nesting, maybe take a step back and see if you can put together the higher level scaffolding of your navigation first.