Activity 和 FragmentActivity 的区别 [英] Difference between Activity and FragmentActivity

查看:38
本文介绍了Activity 和 FragmentActivity 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在处理片段时遇到了两个被多次使用的 ActivityFragmentActivity.我想知道这两者之间有什么区别,因为当我用 FragmentActivity 更改 Activity 时,它对应用程序没有影响.

I was working on fragments and came across two things Activity and FragmentActivity which are used several times. I want to know that is there any difference between these two, because when I changed Activity with FragmentActivity, it had no effect on the app.

推荐答案

A FragmentActivityActivity 的子类,专为 Android 支持包.

A FragmentActivity is a subclass of Activity that was built for the Android Support Package.

FragmentActivity 类添加了几个新方法以确保与旧版本的 Android 兼容,但除此之外,两者之间确实没有太大区别.只需确保将所有对 getLoaderManager()getFragmentManager() 的调用更改为 getSupportLoaderManager()getSupportFragmentManager() 分别.

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.

这篇关于Activity 和 FragmentActivity 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆