I have to create android layouts that have the below structure :
TabHost |
MainActivity1
|
|--TabHost--|SubActivity 1
|SubActivity 2
MainActivity2
|
|--TabHost--|SubActivity 1
|SubActivity 2
MainActivity3
|
|--TabHost--|SubActivity 1
|SubActivity 2
I have currently implemented this structure using the deprecated TabHost/TabActivity/LocalActivityManager, but I am now facing problems like in one of the activities I need the camera to be invoked from a SubActivity and due to this structure onActivityResult doesnt return to the correct subactivity resulting in loss of the picture data taken. I am moving to Fragments and View Pager and hope to overcome these errors. The question is whether implementing ViewPager inside another ViewPager a good idea ? If not then how do we achieve tabs inside tabs ?
P.S. I need an interface similar to instagram profile, main activity in tabs and sections in tabs as well. Please refer the attached picture.
As you're gonna use ViewPager
, and it is most often used in conjunction with Fragment
and FragmentPagerAdapter
, I think that you will not run into any problems if one of the fragments contains another ViewPager
or anything else. That's the beauty of fragments, in my opinion.
Maybe you will run into some problems regarding the swype gesture, but I guess you can disable it in one of the ViewPagers.