I am starting developing a new application based on fragments. What I want to achieve is something similar to an activity group. Talking in fragments I was thinking to start create a FragmentActivity (call it TabActivity) that would manages different tabs. Every tab is compound of a ListFragment and I need to start different fragment based on the user input. My idea lets implement the TabActivity different CallBackListener (one for ListFragment) and, based on the call back called, create a new fragment. Could be this a correct solution? I found the documentation a bit confusing and a little frustrating…
TabActivity:
ListFragment1: fragment1 -> fragment2 -> fragment3
ListFragment2: fragment4 -> fragment5 -> fragment6
ListFragment3: fragment7 -> fragment8 -> fragment9
thanks in advance
EDIT: every ListFragment shares the same container in order to show their content
I have done something similar where I have an Activity that is just a controller/container for what Fragments will be viewable at any given time.
I have a method on the Activity that accepts enough information to determine what Fragment is to be shown, and the bundle it needs to populate the Fragment. Fragments can then tell the activity that it needs to change out, or add the new Fragment using that interface.
My particular case actually uses the same mechanism to control the content of several different “fragment containers” in the layout of the parent Activity.