FragmentActivity和Activity的区别及何时使用两者
2014-04-09 09:53
375 查看
区别:A
a subclass of
was built for the Android
Support Package.
The
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
http://stackoverflow.com/questions/10477997/difference-between-activity-and-fragmentactivity
FragmentActivityis
a subclass of
Activitythat
was built for the Android
Support Package.
The
FragmentActivityclass
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
相关文章推荐
- FragmentActivity和Activity的区别及何时使用两者
- 何时使用 const 迭代器的?又在何时使用 const_iterator?解释两者的区别。
- ButterKnife在activity和Fragment中使用的区别
- 使用FragmentActivity出现空指针异常
- app包中的fragment和v4包中的fragment的使用的区别 发布: 2014-02-17 11:21 | 来源:网络整
- 【Android界面实现】FragmentPagerAdapter与FragmentStatePagerAdapter使用详解与区别
- Activity中与ListActivity中使用listview区别
- 引用与指针有何区别?何时只能使用指针不能使用引用?
- app包中的fragment和v4包中的fragment的使用的区别
- Android Activity生命周期以及Fragment生命周期的区别与分析
- fragment各种情况下的生命周期、状态保存startActivityForResult是哪个类的方法,在什么情况下使用?
- 关于Activity及启动模式,Fragment,Service的使用以及生命周期
- android中fragment的使用及与activity之间的通信
- android基础内容介绍(XXXDrawable、Android动画、Android资源使用、Fragment与Activity)
- 深入分析:Fragment与Activity交互的几种方式(二,使用Bundle)
- 深入分析:Fragment与Activity交互的几种方式(三,使用接口)
- ViewPager 的适配器 PagerAdapter 、FragmentPagerAdapter与FragmentStatePagerAdapter使用详解与区别
- Fragment 和 FragmentActivity的使用
- 在Activity之间使用Intent传值和Bundle传值的区别和方式
- app包中的fragment和v4包中的fragment的使用的区别