I am trying to show mapview on my listview. Map cannot load in listview. If i touch the map view, map will load. If i scroll the listview mapview goes to unloaded initial st
I came across the same problem, and using your code and other stack topics I came up with this way of doing it
mapView.onCreate(savedInstanceState);
mapView.onResume();
mapView.getMapAsync(
new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googlemap) {
final GoogleMap map = googlemap;
map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
MapsInitializer.initialize(context);
map.setMyLocationEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
LatLng sydney = new LatLng(-33.873, 151.206);
String markerTitle = "Sydney";
String snippetTitle = "Lovely city";
if (markerTitle != null && snippetTitle != null) {
map.addMarker(new MarkerOptions()
.title(markerTitle)
.snippet(snippetTitle)
.position(sydney));
}
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney2, 13));
}
}
);
1) You need to call onResume(); on mapView so it loads properly 2) Use .getMapAsync, getMap is deprecated
You will be able to zoom in with a double tap :)