Why should I use FragmentPagerAdapter instead of FragmentStatePagerAdapter?

Viewed 2466

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?

3 Answers

if your structure depend on nested fragment and if you need to use childFragmentManager on inner fragment you might have a stack problem with FragmentStatePagerAdapter. when i got this problem i've changed FragmentStatePagerAdapter with FragmentPagerAdapter and it worked well.

Related