it is about android and google maps v2. I want to set max zoom level with bounds. Here is the method I'm using :
gMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, width, height, padding));
I've found this link which gave me a possible workaround Setting max zoom level in google maps android api v2
Here is the workaraound found
gMap.setOnCameraChangeListener(new OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition position) {
if (position.zoom > DEFAULT_ZOOM)
gMap.animateCamera(CameraUpdateFactory.zoomTo(DEFAULT_ZOOM));
}
});
But this solution zoom in until the zoom level defined by first animateCamera
and then zoom out until DEFAULT_ZOOM if (DEFAULT_ZOOM < position.zoom). In this case, there is two animateCamera
How to avoid that ? And make only one animateCamera
Thx in advance