I am trying to do something similar as https://stackoverflow.com/a/24437224/2277631. I am even using the same layout:
I am following this approach because I am using a NavigationView (each option is a fragment) that has the first option as a fragment with Tabs (so a ViewPager with more fragments).
I found a problem when using:
viewPager.setAdapter(new AdapterView(getChildFragmentManager()));
Basically, using the ViewPager as nested fragment, it only loads 1 page (from the 3 tabs), and it only loads the other pages when I swipe to them (each tab is a fragment with its ContentLoader). I found that using setOffscreenPageLimit
gets ignored in this case. Instead, if I use:
getActivity().getSupportFragmentManager()
then the ViewPager works as expected (loading by default 1 page and the next and previous pages). But then, a lot of weird stuff happen (cause I am suppose to use getChildFragmentManager
when using nested fragments). So... Any ideas of using ViewPager as nested fragment and make setOffscreenPageLimit
to work?
Edit 1 (30 Dec 15)
Tracking the bug down, I checked that all the fragments are been created. The problem is that the three fragments have they own LoaderCallback
but only the first one calls onLoadFinished
. Trying to figure out why the other fragments only call onLoadFinished
when navigating to it (was working without the nested approach).