Add commit to method destroyItem
Hi Daniel,
Should you not commit the remove transaction on destroyItem method overriden ?
I mean from :
mCurTransaction.remove(fragment);
to
mCurTransaction.remove(fragment).commit();
at line 124 of UpdatableFragmentPagerAdapter class.
I am having a problem that after onSave/Restore instance of the viewpager, some fragment remain on the memory and are reused even after I create a new adapter... So, every time I put the app on background and then on foreground, the number of the instances of the used fragment from getSupportFragmentManager().getFragments() increases with 2 (I use one OffscreenPageLimit).
Thanks!
@VladTE sorry for the late reply, commit is called inside finishUpdate() 🤔 ... Can you maybe make a sample project where we can isolate the issue and fix it?
Hi @DanielNovak !
Ok, this cold be the problem. The number of the fragments always increases after a background-foreground switch of the app, and the method has this warning : "This is dangerous because the commit can be lost if the activity needs to later be restored from its state". Right now I don't have time to invest on this, but when I get the chance, I will make a new project to find a solution for my problem.
Thanks, VladTE