ListFragment Support Library GetSupportFragmentManager undefined

I have a list Fragment (importing the v4 support library, build target is 2.3.3 api 11)
and the following problem in my code that was working fine when the target was 3.0 and I didn’t use the library.

Fragment frag1 = new ExampleFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(, frag1);

Now I’m getting the compile error that

  • Where do I create and use ScheduledThreadPoolExecutor, TimerTask, or Handler?
  • Is there a way to generate ant file without overwriting build.xml?
  • SERVER_ERROR: 1675030 : Error performing query
  • Version conflict updating to play-services 9.4.0 Android studio 2.2
  • How to pause using DownloadManager?
  • How to group android notifications like whatsapp?
  • "Type mismatch: cannot convert from ExampleFragment to Fragment"

    and it tells me to change the “Fragment” to ExampleFragment (e.g.)

    ExamplesFragment frag1 = new ExamplesFragment();
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.replace(, frag1);

    Then I have a problem that the ft.replace command has an error:

    The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, Fragment_PVAnn)

    and it tells me to change the ExamplesFragment in the first line back to just Fragment and so the circle goes round and around

  • Hindi Character will not display in web view correctly
  • How do I find out if the GPS of an Android device is enabled
  • Determine reason for odex file size bloat
  • Feature Detect Autoplay HTML5 Audio - Audio on Mobile Browsers
  • How to emulate GPS location in the Android Emulator?
  • PopupWindow in android
  • 2 Solutions collect form web for “ListFragment Support Library GetSupportFragmentManager undefined”

    You should use


    If that is still giving you problems, then makre sure that your Activity extends FragmentActivity.

    If that is still giving you problems,

    1. Delete all of your imports,
    2. Re-import with Ctrl + Shift + O, and
    3. On every name clash, make sure you import from support.v4.*, not android.*.

    You have to make sure that when you extend Fragment that you are extending the Fragment that is in the v4 package space. Check your imports for Fragment, FragmentActivity, etc, and if you see them imported WITHOUT .v4 in the package name, then it is wrong.

    Also, if you set the android library for the project to be 2.3 and not 4.0.x then you’ll quickly see if you are using the incorrect classes, because you’ll get compile errors, which can be fixed by using the v4 classes from the android support jar (which hopefully you’ve included in your project as well)

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.