0

I am using view pager with nested fragments. Suppose assume that am having 5 fragments and i have chosen the 2nd fragment which has some button and i click on that new view will display.Now if i move to 3rd fragment and come back again to 2nd fragment it still display the new view not the list(parent). i guess its because of view pager is caching the data. Is there any possible way to solve this. I tried mViewPager.setDrawingCacheEnabled(false); but its not helping out.

When i gone through mViewPager.setCurrentItem() it caches the inner item like setCurrentItemInternal(item, !mFirstLayout, false); Any help is appreciated

Kalai.G
  • 1,610
  • 13
  • 22
  • You must be creating a View Pager by extending FragmentPagerAdapter. Instead, you can try using FragmentStatePagerAdapter. FragmentStatePagerAdapter doesn't save the current fragment in cache or memory unlike FragmentPagerAdapter. Let me know if that helps. Refer this: http://stackoverflow.com/questions/18747975/difference-between-fragmentpageradapter-and-fragmentstatepageradapter – Adithya Upadhya Dec 01 '15 at 09:13
  • @oathkeeper am using FragmentStatePagerAdapter only dude – Kalai.G Dec 01 '15 at 10:37
  • @Kalai.G How did you add new view in 2nd fragment. could you please post your code. – Nas Dec 01 '15 at 11:13

0 Answers0