标签:
getSupportFragmentManager() ,FragmentActivity用在android sdk 3以下.
getFragmentManager() + Activity 用在android sdk 3以上.
A FragmentActivity
is a subclass of Activity
that was built for the Android Support Package.
The FragmentActivity
class adds a couple new methods to ensure compatibility with older versions of Android, but other than that, there really isn‘t much of a difference between the two. Just make sure you change all calls to getLoaderManager()
and getFragmentManager()
to getSupportLoaderManager()
and getSupportFragmentManager()
respectively.
Fragment is a part of an activity, which contributes its own UI to that activity. Fragment can be thought like a sub activity. Where as the complete screen with which user interacts is called as activity. An activity can contain multiple fragments.Fragments are mostly a sub part of an activity.
An activity may contain 0 or multiple number of fragments based on the screen size. A fragment can be reused in multiple activities, so it acts like a reusable component in activities.
A fragment can‘t exist independently. It should be always part of an activity. Where as activity can exist with out any fragment in it.
Fragment(9)FragmentActivity和Activity的区别
标签:
原文地址:http://www.cnblogs.com/cocl/p/4603156.html