The method getFragmentManager() is undefined for the type MyActivity

15,024

Problem solved.

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

Share:
15,024
Thordax
Author by

Thordax

Updated on June 13, 2022

Comments

  • Thordax
    Thordax about 2 years

    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);
    

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

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

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

    Here is the 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);    
    }
    
    }
    

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