I have a ViewPager with a FragmentPagerAdapter, and my app has previously used just two fragments (different types) without issues.
I just added a third fragment, though, and now my adapter/viewpager seems to be destroying my fragments when I get far away from them. For example, if I'm on page 1, page 3 is destroyed and recreated when I get close to it. If I'm on page 3, the same happens to page 1.
This is causing lots of issues in my app. The fragments aren't very RAM-heavy at all, so how can I stop this from happening?
FragmentPagerAdapter
yourFragments
once created will never be destroyed while swiping. Only onPause and onStop method will be called. Probably you are usingFragmentStatePagerAdapter