Should be used in the activity
Getsupportfragmentmanager ()
If you use
Getfragmentmanager ()
, in the jump custom fragment will compile an error.
Wrong 2nd argument type ....
Using Getfragmentmanager () in a custom fragment is no problem.
By viewing the source, acrivity in Getfragmentmanager () is
Package Android.app;
Package under the code, while fragment is
Package Android.support.v4.app;
Under the. It's like there are two families in the family who cannot duplicate the same name,
Package Android.app
There is a small Ming, and V4 under a small Ming.
Then the custom fragment is V4 under the Xiao Ming, if in the activity with Getfragmentmanager () forcibly gave Android.app, that Android.app pit will not agree.
If you use
Getsupportfragmentmanager ()
There is no problem, because he is under the V4, so you can send this xiaoming back to V4.
Unable to use Getfragmentmanager () in activity