I've been searching for it and all I found was the difference between them. And that's not the point.
If you use FragmentStatePagerAdapter
in a ViewPager
, you'll end up doing the same as you'd do with FragmentPagerAdapter
, but consuming much less memory. If that's true, why should I use the FragmentPagerAdapter
?
What is the advantages of using FragmentPagerAdapter
?
What is the advantages of using FragmentPagerAdapter?
Speed, particularly when you have an intermediate number of pages: enough to easily hold in memory but beyond the handful that ViewPager
wants to hold onto itself. With FragmentStatePagerAdapter
, as the user navigates the pager, the adapter destroys some fragments and creates new ones. That takes time, both in terms of the direct Java code and in terms of the impact upon garbage collection. If you do not need that in some circumstance, why pay the price?