Tuesday, July 15, 2014

Widgets

FragmentStatePagerAdapter getItem not called

Using FragmentStatePagerAdapter instead of FragmentPagerAdapter might fix this problem. 

FragmentPagerAdapter stores the whole fragment in memory, and could increase a memory overhead if a large amount of fragments are used in ViewPager. But FragmentStatePagerAdapter only stores the savedInstanceState of fragments, and destroys all the fragments when they lose focus. 

Hence FragmentStatePagerAdapter should be used when we have to use dynamic fragments.

No comments:

Post a Comment