Double Tap to Zoom Feature for Map Fragment
Have You tried to set your listener onMapReady() call back? and then set
mMap.getUiSettings().setZoomGesturesEnabled(true);
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
try {
// mMap.clear();
mMap.getUiSettings().setZoomGesturesEnabled(true);
}
}
I tried all possible solutions from here and here in which they have given some other ways to handle the double tap by the help of the touch event. But unfortunately nothing worked for me.
So I ended with the predefined onMapClickListener()
which calls on a single click of the map. I pasted my solution below:
getMap().setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
getMap().animateCamera(CameraUpdateFactory.zoomIn());
}
});
Anyways thanks Karan Mer for the help.