ActionBarSherlock with ViewPager not calling ViewPager fragments lifecycle methods when going to and returning from backstack

后端 未结 1 1149
再見小時候
再見小時候 2021-01-05 18:43

I have an application that uses ActionBarSherlock and inside the main fragment I have a ViewPager which uses several fragments to display different objects of a list.

相关标签:
1条回答
  • 2021-01-05 19:17

    When you are creating the view adapter You have to pass the fragment child manager as argument - getChildFragmentManager() instead of getFragmentManager().

    Instead of,

     mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getFragmentManager());
    

    you should use,

     mDemoCollectionPagerAdapter = new DemoCollectionPagerAdapter(getChildFragmentManager());
    
    0 讨论(0)
提交回复
热议问题