该方法getFragmentManager()是未定义的类型MyActivity [英] The method getFragmentManager() is undefined for the type MyActivity

查看:154
本文介绍了该方法getFragmentManager()是未定义的类型MyActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我一直在使用我的code,我使用的片段。

Since I've been using my code, I used fragments.

要做到这一点,我有一个活动使用的片段通过标签调用一个片段:

To do so, I have an activity calling a fragment using a fragment by tag :

FluxListFragment FLF = (FluxListFragment) getFragmentManager().findFragmentByTag(FRAG_LIST);

不过,从今天起,getFragmentManager似乎无法识别。它说:

But since today, getFragmentManager seems to be unrecognized. It says :

"The method getFragmentManager() is undefined for the type FluxMainActivity"

时从构建目标未来的问题? (我把安卓3.0)

Is the problem coming from the build target ? (I put Android 3.0)

下面是code:

public Class FluxMainActivity extends Activity {

@override
public void onCreate(Bundle saveInstanceState)
{
    super.onCreate();
    setContentView(R.layout.main);
    FluxListeFragment FLF = (FluxListeFragment)getFragmentManager().findFragmentByTag(FRAG_LISTE);    
}

}

该方法应与FluxListeFragment而不是FluxMainActivity!我认为中投不正确。

The method should be linked to FluxListeFragment and not FluxMainActivity ! I think the cast is incorrect.

推荐答案

问题解决了。

该项目的目标是在11 API,但它包含了2库与他们的目标API 8之一。

The project target was in API 11, but it contained 2 libraries with one of them in target API 8.

这篇关于该方法getFragmentManager()是未定义的类型MyActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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