Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commit to method destroyItem #5

Open
VladTE opened this issue Jun 13, 2018 · 2 comments
Open

Add commit to method destroyItem #5

VladTE opened this issue Jun 13, 2018 · 2 comments

Comments

@VladTE
Copy link

VladTE commented Jun 13, 2018

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!

@DanielNovak
Copy link

@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?

@VladTE
Copy link
Author

VladTE commented Jul 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants