Shared publicly  - 
 
 
Nesting Fragments in a ViewPager.

A new solution to an old problem: Back in August Mark Murphy of +CommonsWare asked Twitter how to show multiple children in a ViewPager and received a few interesting responses. My own solution was a custom view pager containing one ViewGroup (with its own view hierarchy) per page, similar to  +Nicolas Klein's  but a bit more generic. I refactored that code this morning to use a simple FragmentPagerAdapter instead. Each page consists of a single fragment which in turn contains more fragments. Here is an example, compatible alllll the way back to API v4.

I got rid of good bit of code, and what was left was much more elegant. Nested fragments are really nice.
1
Add a comment...