Search code examples
androidactionbarsherlockactionbarsherlock-map

ActionBarSherlock Tabs+Fragments+MapView


Actually I have 2 Fragments, one is Menu and other is Content Fragment. Now I need to add Google Map to the Content Fragment. I have added Google Maps Plugin for ABS. But how to use it in a Fragment. I can

public class MapActivity extends SherlockMapActivity

but how to make it done in a Fragment

like: public class MapFragment extends SherlockMapFragment

Actually I want to use two tabs in a fragment (say Fragment B) and show some textview in one tab and mapview in other fragment. I have FragmentActivy (Home) and it has two fragments A and B. A is sliding menu and B is content menu.

Is is possible to show two tabs in a fragment and use two different layouts in two tabs ?

I cannot extends SherlockMapActivity as I need to use it in a Fragment :(


Solution

  • MapViews can not be ran as part of a fragment layout. There's no library that will give you that, as long as i know.

    Though, there's a hack that will allow you to put a MapView in a fragment, but it's a little bit more elaborated.

    You can take a look to it here

    http://xrigau.wordpress.com/2012/03/22/howto-actionbarsherlock-mapfragment-listfragment/