I am facing memory leak because some fragments are not removed. I have Activity that populates view with Fragment F1. This fragment has ViewPager and FragmentStatePagerAdapter associated with it. Adapter is feeling pager with another Fragment F2. Problem starts when in Activity I remove Fragment F1. Existing Fragments F2 are not removed.
any suggestions?
Not sure if it is the same problem, but some time ago I had a problem with viewpager where the fragment lifecycle methods were never called and the problem was with the fragment manager.
So, when you create the adapter try passing childFragmentManager instead of supportFragmentManager and see if it fixes your issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With