Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Compatibility Package doesn't include Activity.getFragmentManager()

I started trying to add fragments to my Android app, which is based on 2.1, using the Android Compatibility Package that just came out on March 3rd. I included the library into my project, and started moving the code from my Activity-based class to a Fragment-based one, but I noticed that the Fragment examples from Google seem to rely on the fact that the Activity class in 3.0 (Honeycomb) has the new method getFragmentManager(). It seems to be an integral hook into the Fragment system.

I've tried to look inside the Compatibility Package library for some included Activity implementation that has getFragmentManager(), but I can't find it. Does anyone know where I can find getFragmentManager() so I can include Fragments for Honeycomb compatibility, or if not do you know how I can include Fragments without using a FragmentManager?

like image 559
Ski Avatar asked Mar 06 '11 06:03

Ski


1 Answers

You will need to extend FragmentActivity instead of the normal Activity. Then you will be able to call getSupportFragmentManager() which works the same way as getFragmentManager().

like image 158
Kaloer Avatar answered Oct 13 '22 05:10

Kaloer