Search code examples
androidgoogle-mapsactionbarsherlock

Google map v2 not showing, but marker shows


I'm working in a Google Maps v2 in android, inside a Sherlock Tab :

I got it "working", I can add markers on the map, and I have all the controls, but the map never load ( I don't see streets). When I click on a marker, streets are showing, but I can't move nothing with the finger. Zoom in and zoom out shows, but doesn't work.

When I change Tab and come back to the map, the map disappear once more.

Here is my code (the tab the tab display):

public class MapPdvTabFragment extends SherlockFragment {
SupportMapFragment mMapFragment;
ArrayList<Pdv> tiendas;
private View fragmentView;

private MapView mapView;
private GoogleMap resultsMap;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    this.fragmentView = inflater.inflate(R.layout.tab_frag_map_pdv, container, false);
    return this.fragmentView;

}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    FragmentTabsPdv parent = (FragmentTabsPdv) getActivity();
    mapView = ((MapView) this.fragmentView.findViewById(R.id.map));
    try {
        MapsInitializer.initialize(getActivity());
    } catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
    }
    mapView.onCreate(null);
    resultsMap = this.mapView.getMap();
    int zoom = 14;
    CameraUpdate here = CameraUpdateFactory.newLatLngZoom(new LatLng(19.359180, -99.180901), zoom);
    resultsMap.moveCamera(here);
    tiendas = parent.getListaPdv();
    displayPdvOnMap(tiendas); // Display marker ( work well)

}
}

enter image description here


Solution

  • the problem were resolved with this code : https://gist.github.com/joshdholtz/4522551