What is the difference between FragmentPagerAdapter and FragmentStatePagerAdapter?

Bảo Vy

Member
What is the difference between FragmentPagerAdapter and FragmentStatePagerAdapter?
Answer
As I explained FragmentPagerAdapter stores the whole fragment in memory, and could increase a memory overhead if a large amount of fragments are used in ViewPager. In contrary its sibling, FragmentStatePagerAdapter only stores the savedInstanceState of fragments, and destroys all the fragments when they lose focus.
 

Tìm kiếm

Back
Top