Reputation: 93
I'm currently developing an application that has a tab bar, and 3 different views: the first is a master-detail, the second one a gallery, the third is a simple webview.
I was using the TabActivity, but since Android 3.0, this class is deprecated and Android reference suggests to use Fragments.
I switched then to an ActionBar, with Tabs and Action Items. Inseide the first tab item I have a layout with 2 fragments (my master-detail view). When I switch through tabs I want that my layout change as I described above, so I thought to hide the left fragment (the master listview) and work only in the detail fragment.. but with this solution I have only one main activity with a lot of fragments attached to it, and for each fragment displayed I need to modify the Action Item shown and handle different actions in OnOptionItemSelected.
Is this a good way to implement this kind of application or should I consider different solutions?
Upvotes: 1
Views: 457
Reputation: 11230
You should have a single fragment container where the fragments are replaced depending on the tab selected.
One activity and multiple fragments is the right approach.
Upvotes: 4