ViewPager in TabFragment is not loading a second time ViewPager in TabFragment is not loading a second time android android

ViewPager in TabFragment is not loading a second time


I found the problem. It took me two days, but hey, it's fixed.

Instead of using

mAdapter = new AlbumAdapter(getFragmentManager(), mActiveProject.getInspiration());

You should use

mAdapter = new AlbumAdapter(getChildFragmentManager(), mActiveProject.getInspiration());

So much for 5 characters.


I been searching this for long finally found a solution.Change your page adapter instance FragmentPagerAdapter to FragmentStatePagerAdapterexample:

class PageAdapter extends FragmentStatePagerAdapter {


you should use getChildFragmentManager() instead of getFragmentManager() and FragmentStatePagerAdapter() instead of FragmentPagerAdapter().Hope it will be useful for someone.