Here's my code. I have 2 activities. 1. MainActivity 2. Mapsactivity. This zoom is not working. Except the zoom all works fine. Marker and everything
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMapLongClickListener(this);
if(location!=-1 && location!=0) {
locationManager.removeUpdates(this);
LatLng latlng = MainActivity.locations.get(location);
mMap.addMarker(new MarkerOptions().position(latlng).title(MainActivity.places.get(location)));
mMap.moveCamera(CameraUpdateFactory.newLatLng(latlng));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latlng), 15);
}else{
locationManager.requestLocationUpdates(provider, 400, 1, this);
}
}
If you are using SupportMapFragment
then to enable zoom feature use this line of code :
googleMap.getUiSettings().setZoomControlsEnabled(true);
and to animate camera with zooming feature use this :
googleMap.animateCamera(CameraUpdateFactory.zoomTo(16), 5000, null);