getFragmentManager()和支持包 [英] getFragmentManager( ) and support package

查看:240
本文介绍了getFragmentManager()和支持包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习使用片段为构建一个动态的应用程序,但我已经与段管理的问题。当我的方法getFragmentManager通过它,因为它返回android.app的片段经理,而不是从支持库()被裁判员警告。
你知道如何解决它?

I'm learning to use fragments for build a dynamic application, but I've a problem with the Fragment Manager. When I pass it by the method getFragmentManager( ) is shown a warning because it returns the Fragment Manager of android.app, not from the support library. Do you know how to fix it?

推荐答案

您应该使用 getSupportFragmentManager()而不是 getFragmentManager()

此外,请确保您正在扩展 FragmentActivity 而不仅仅是活动

Also, make sure you are extending FragmentActivity and not just Activity.

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

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