Facing a problem to set dynamic zoom level in android google map.
something like doing In map application (system application of android).!


I used below method of map
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(START_POINT, 50)); mGoogleMap.animateCamera(CameraUpdateFactory.zoomTo(14.0f));
Use following code:
mGoogleMap.animateCamera(CameraUpdateFactory.zoomTo(17),200, null);
Here 17 is zoom level you can change that.
Or try following code to cover all points
//Calculate the markers to get their position
LatLngBounds.Builder b = new LatLngBounds.Builder();
for (Marker m : markers) {
b.include(m.getPosition());
}
LatLngBounds bounds = b.build();
//Change the padding as per needed
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 25,25,5);
mMap.animateCamera(cu);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With