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?

Informatheus
  • 1,025
  • 1
  • 9
  • 20
  • 1
    Same here, this is weird. In debug I can see only three items and "size = 4". – JerabekJakub Jul 02 '15 at 11:36
  • 1
    You should be using 'getBackStrackEntryCount' to check the size of your backstack, instead. – marius bardan Sep 03 '15 at 16:58
  • 1
    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 value – Lampione Sep 21 '16 at 14:32
  • Still a problem as of 11/2016. I'm getting the same thing. A similar [issue was filed recently](https://code.google.com/p/android/issues/detail?id=226196&sort=-id&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars) – Al Lelopath Nov 16 '16 at 15:28

0 Answers0