The definition of IS getChildFragmentManager()
:
Return a private Fragmentmanager for placing and managing fragments inside of this Fragment.
Meanwhile the definition of is getFragmentManager()
getSupportFragmentManager()
:
Return the Fragmentmanager for interacting with fragments associated and this fragment ' s activity.
Basically, the difference is that Fragment's now has their own internal that FragmentManager
can handle fragments. The child Fragmentmanager is the one, handles fragments contained within only the Fragment, it was added to. The other fragmentmanager is contained within the entire Activity
.
In this case, what I'm guessing is your ' ve added the fragments to the Activity ' s fragmentmanager. You get the child fragmentmanager which doesn ' t contain what is looking for. Thus get the exception because it can ' t find the Fragment with the given ID because it's in a different fragmentmanage R.
=============================================
Msectionspageradapter = new Sectionspageradapter (getactivity (). Getsupportfragmentmanager ());
In fragment nested fragment words, do not use the above sentence ... will appear in the Viewpager. Some fragment will not load the situation ... Both Viewpager loading Fragment blank pages ....
So fragment inside nested fragment words: Must use Getchildfragmentmanager ();
Msectionspageradapter = new Sectionspageradapter (Getchildfragmentmanager ());
Turn the difference getchildfragmentmanager Getsupportfragmentmanager