Manage navigation properly Tabbar with ActivityGroup or Fragments etc in Android?

293 Views Asked by At

I am using Tabbar with ActivityGroup in one of my example application. Following is the structure of my application

Tab1 -> ParentActivity1 -> ChildActivity_11 -> ChildActivity_12
Tab2 -> ParentActivity2 -> ChildActivity_21 -> ChildActivity_22
Tab4 -> ParentActivity3 -> ChildActivity_31
Tab4 -> ParentActivity4 -> ChildActivity_41

Issue I am facing is when I press native back button in ChildActivity_12 then it should go to ChildActivity_11 but somehow it is exiting from application. Can someone suggest me what should be my checks here ?

Parallely if someone can guide me here to manage navigation properly in navigation controls like Tabbar with ActivityGroup, Fragments etc in Android ?

1

There are 1 best solutions below

0
On

ActivityGroup has been marked as deprecated for quite some time now. If you're looking to achieve a modern look and feel for your application, then ActionBar Tabs and Fragments are the way to go.

One thing to also keep in mind is how modern Android presents tabs to user, as it differs greatly from iOS. On iOS, the TabBarController remains at the bottom of the screen, even after the user navigates inside of tab. On Android, tabs belong to an Activity. If the user navigates deeper, generally a new Activity is presented, and the old Activity's tabs are no longer visible.

As noted in the Android docs on tabs, they're best used for "collection-related sibling screens." If you're looking to provide a collection of equally weighted navigation items, then it might be worth while looking into other patterns, such as the NavigationDrawer, ActionBar Spinners, or a Dashboard.