The difference between the use of the fragment in the app Pack and the fragment in the V4 package, and the need for a friend to refer to below.
1, try not to use the app package in the fragment, because this is after 3.0, the supported version is too high, in the lower version is not used.
2, Android.support.v4.app.Fragment: can be compatible to 1.6 version.
3, regarding these two fragment to use the label question:
(1), app.fragment and v4.fragment can be used <fragment> tags, Only in the use of the time if it is app.fragment there is no special place, the activity of fragment is normal to inherit the activity class.
(2), when the V4.fragment use the label should pay special attention to:
When the activity is going to use android.support.v4.app.Fragment , the activity must inherit fragmentactivity, or it will get an error:
Caused By:java.lang.ClassCastException:com.example.android_fragment_bottom.fragments.TopBarFragment cannot be cast To Android.app.Fragment
At this point, if you do not inherit Fragmentactivity, the compilation system will treat android.support.v4.app.Fragment as the fragment in the app package. But at this point we are importing the fragment in the V4 package.
An example of fragment in the official Android document is the fragment in the app package.
(3), the application package about the fragment class and methods in the V4 package are corresponding.
(4), the method of obtaining Fragmentmanager is different:
android.app.Fragment: Use the Getfragmentmanager () method.
android.support.v4.app.Fragment: Use the Getsupportfragmentmanager () method.
The difference between the use of the fragment in the app Pack and the fragment in the V4 package