Home > Mobile >  Always setMaxLifecycle for fragments not attached to FragmentManager
Always setMaxLifecycle for fragments not attached to FragmentManager

Time:01-08

In FragmentPagerAdapter wrote a method to remove certain fragments in the viewpager
FragmentTransaction transaction=FM. BeginTransaction ();
Transaction. Remove (fragments);
Transaction.com mitNow ();
So far is normal removed but the next switch
MViewPager. SetCurrentItem (position, false);

To quote the error
Java. Lang. IllegalArgumentException: always setMaxLifecycle for fragments not attached to FragmentManager FragmentManager
Which greatly help below the answer
  • Related