Question

I know there are a few questions like this but what I'm looking for is slightly different the way I see it.

THE PROBLEM

I have one Activity and I am only ever going to have one Activity.

I do however have multiple Fragments; one of which contains a MapView.

I have successfully got this working in API level 3.0 and greater. However, the problems start when I want to go lower than this using the compatibility library as I then need to make my Activity extend FragmentActivity to get Fragments to work and then I obviously lose the ability to also extend MapActivity

THE QUESTION

How can I use the Compatibility Support Library to enable the use of Fragments and a MapView within the same Activity?

Any help would be greatly appreciated.

P.S I personally think it's ridiculous they didn't include support for this within the Compatibility Support Library.

Was it helpful?

Solution

I've done exactly this! Using this:

https://github.com/petedoyle/android-support-v4-googlemaps

It took some time, but with this, I've been able to have Fragments and a MapView inside the same Activity down to 2.3 (probably lower, as well). You basically get the jar from that github site, which is called android-support-v4-r7-googlemaps.jar, and use that instead of the default support library. With that, your main activity still extends FragmentActivity (which is extending MapActivity in the background).

There should be a readme at that same link for further direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top