I finally solved it, you dont have to override getMap()
and you dont need the mMap variable, the GoogleMap is included in the class. Finally you need to call initMap() in onResume:
public class PlaceMapsFragment extends SupportMapFragment {
private LatLng mPosFija = new LatLng(37.878901,-4.779396);
public PlaceMapsFragment() {
super();
}
public static PlaceMapsFragment newInstance(LatLng posicion) {
PlaceMapsFragment frag = new PlaceMapsFragment();
frag.mPosFija = posicion;
return frag;
}
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
initMap();
}
@Override
public void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
//initMap();
return view;
}
private void initMap() {
UiSettings settings = getMap().getUiSettings();
settings.setAllGesturesEnabled(false);
settings.setMyLocationButtonEnabled(false);
getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(mPosFija, 16));
getMap().addMarker(
new MarkerOptions().position(mPosFija)
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker)));
}
}
Hope it helps other people that are starting with the v2 of google maps api (like me :D).