Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The method getFragmentManager() is undefined for the type MyActivity

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.

like image 421
Thordax Avatar asked May 15 '12 08:05

Thordax


People also ask

Is the method(methodname) undefined for the type(ClassName)?

The method (methodName) undefined for the type (className) Specific errors The method contains(String) is undefined for the type String The method codePointAt(String) is undefined for the type String

Is the method getresources undefined for the type list?

The method getResources() is undefined for the type The method getSystemService(String) is undefined for the type List Problem This error message appears in java when the method is not defined in that class.

What is the method is undefined for the type error in Java?

This tutorial demonstrates Java’s the method is undefined for the type error. The error the method is undefined for the type occurs whenever we try to call a method that is not defined in the current class. An example throws the the method is undefined for the type error.

What is the difference between the method format(string) and gettypeparameters(typevariable)?

The method format(String) is undefined for the type String The method getTypeParameters(typeVariable) is undefined for the type typeVariable


1 Answers

Problem solved.

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

like image 123
Thordax Avatar answered Sep 16 '22 21:09

Thordax