FragmentActivity和Activity的区别及何时使用两者

区别: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.


使用:use Activity if you are using android.app.Fragment; use FragmentActivity if you are using android.support.v4.app.Fragment. Never attach a android.support.v4.app.Fragment to a android.app.Activity, as this will cause an exception to be thrown.

http://stackoverflow.com/questions/10477997/difference-between-activity-and-fragmentactivity


posted @ 2014-04-09 09:53  thirsty coder  阅读(293)  评论(0编辑  收藏  举报