AndroidDev AndroidDev - 1 year ago 97
Android Question

Center a map marker in Android

I use the following code to display a single marker at a zoom level but it doesn't center tha marker on the map. Only one marker will ever be shown:

LatLng latLng = new LatLng(Latitude, Longitude);
cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 11.0f);

This code will center it but it doesn't provide any zoom:

LatLngBounds bounds =;
cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 30);

I need to center AND zoom.

Answer Source

The correct value for zoom is between 2.0 and 22.00.

After this you've to add this line

GoogleMap mMap;
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latlng, 10));

About zoom you can read this from documentation zoom: the desired zoom level, in the range of 2.0 to 21.0. Values below this range are set to 2.0, and values above it are set to 21.0. Increase the value to zoom in. Not all areas have tiles at the largest zoom levels.

You can check this on

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download