I'm developing an android app which has a login view, and after login it loads a view with tabs. Each tab can contain a sequence of views. The structure looks like
login -> tab view
- tab 1
- view 1a -> view 1b -> view 1c
- tab 2
- view 2
- tab 3
-view 3a -> view 3b
Each tab is independent of each other. So far I have implemented it so that login and tab view are activities, each tab contains one fragment, and on view change, the content is changed with
mViewId = R.layout.new_view_id;
getFragmentManager().beginTransaction().detach(ChargeLunchFragment.this)
.attach(ChargeLunchFragment.this).commit();
mViewId is used in onViewCreated to load the correct view. What is the "correct" way to implement this kind of structure? Would it be better to have one fragment per view? How would that change the FragmentPagerAdapter?
Another thing is up navigation. I'd like the up button action to depend on the current view. For example, in view 1c up button should load view 1b, in 1b it should load 1a, and in 1a the up button should not be shown. How can I access up button (or action bar) from a fragment? Or should it be handled on the activity level?