Android Compatibility Pack does not include Activity.getFragmentManager ()

I started trying to add fragments to my version 2.1-based Android app using the Android Compatibility Package, which was released only on March 3. I included the library in my project and started moving the code from my activity-based class to fragmented, but I noticed that the snippet examples from Google seem to rely on the Activity class in 3.0 (Honeycomb) to have a new getFragmentManager ( ) This seems to be an integral hook into the Fragment system.

I tried to look into the compatibility package library for some of the included Activity actions that have getFragmentManager () but I cannot find it. Does anyone know where I can find getFragmentManager (), so I can enable Fragments for Honeycomb compatibility, or if you don't know how to include fragments without using FragmentManager?

+79
android android-activity android-fragments
Mar 06 2018-11-11T00:
source share
3 answers

You will need to expand FragmentActivity instead of the usual Activity . Then you can call getSupportFragmentManager() , which works just like getFragmentManager() .

+150
Mar 06 '11 at 8:23
source share

You need to change your Android object to API level = 12

0
Jun 11 '13 at 14:54
source share

For people trying to do this job with the Google Maps SDK, see getFragmentManager with API8 and don't forget to update your layout file too!

0
Dec 08
source share