Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapview and Fragment

I've seen some topics some months ago, about the fact that using (Google)MapView inside a Fragment was a bit tricky/impossible. I would like to know if atm (June) there is a workaround ? My application (Android 3.0) is essentially working with the Fragment system and I need to display a map in one of these fragments.

like image 229
kudos Avatar asked Jun 27 '11 07:06

kudos


2 Answers

Currently I only know of one solution. I stumbled across this when I ran into the same problem. https://github.com/petedoyle/android-support-v4-googlemaps.

EDIT

Here is a newer fork based off r9 https://github.com/rfc1459/android-support-v4-googlemaps

You can build it via eclipse or download a compiled version here https://github.com/rickbarrette/android-support-v4-googlemaps/downloads

like image 174
Rick Barrette Avatar answered Sep 20 '22 10:09

Rick Barrette


There is another question already. Basically the workaround is to create an Activity manager and a TabHost and create a single tab containing a MapActivity. In this way you can load a separate MapActivity inside a Fragment.

For more information see the sample project provided by the original answerer.

like image 37
Janusz Avatar answered Sep 19 '22 10:09

Janusz