ViewPager in TabFragment not loading second time

狂风中的少年 提交于 2019-11-28 16:49:35

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.

rajesh v

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

class PageAdapter extends FragmentStatePagerAdapter {
Akhtar

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!