FragmentManager.getFragmens().size() dont decrease after FragmentTransaction.remove(Fragment)
Asked Answered
C

0

10

After a while searching the reason of my NPE, i noticed that despite FragmentTransaction.remove(Fragment) reallys removes the Fragment, the size of the List returned by FragmentManager.getFragments() still the same. This screenshot shows what is returned by this method after a fragment removal:

https://www.dropbox.com/s/s3bt1p7i71a5kgx/erro%20fm.PNG

The list have 3 fragments, why size still 4?

Caseworm answered 20/7, 2014 at 19:4 Comment(4)
Same here, this is weird. In debug I can see only three items and "size = 4".Shearin
You should be using 'getBackStrackEntryCount' to check the size of your backstack, instead.Fled
If I'm not wrong, the getBackStrackEntryCount may return an invalid value as I may not add the fragment to the backstack, still the .size() method is returning a wrong valueMicroscope
Still a problem as of 11/2016. I'm getting the same thing. A similar issue was filed recentlyGlamorous

© 2022 - 2024 — McMap. All rights reserved.