سؤال

I am working on Fragments. Fragment1 contains ViewPager. ViewPager has 3 Fragments. when ever I call Fragment1 ViewPager works fine. But if I replace Fragment1 with other Fragment Fragment2 and returns back to Fragment1 using backButton. ViewPager displays nothing. All 3 fragments are added to fragment but onCreateView() is not called and there is no UI for these 3 fragments. I am using FragmentStatePagerAdapter for ViewPager.

Any help will be appreciated.

هل كانت مفيدة؟

المحلول

I think you are using getFragmentManager() or getSupportFragmentManager() in the Fragment which is calling your ViewPager's pages. Try to use getChildFragmentManager instead.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top