1

In my application I need map dragging listener, I have followed the below link: How can I handle map move end using Google Maps for Android V2? But I do not get 100% reliable solution.however its work based on the camera listener. I did the following things:

  1. the code works on whenever the camera zooming.
  2. so I changed the code to zooming level ( if zoom level is increased or decreased I do not call my methods.)
  3. but my function is called if not zooming level is not changed.

my need is How can I get reliable solution by using the camera listener? If any bug is raised regarding the issue on Google please share the link.

my code sample:

map.setOnCameraChangeListener(new OnCameraChangeListener() {
                @Override
                public void onCameraChange(CameraPosition cameraPosition) {
                    if(previousZoomLevel != cameraPosition.zoom) {
                        Log.e("zooming * previousZoomLevel", ""
                                + cameraPosition.zoom + "   "
                                + previousZoomLevel);
                    }
                    else {
                        Log.e("NOT zooming * previousZoomLevel", ""
                                + cameraPosition.zoom + "   "
                                + previousZoomLevel);
                                myMethod();
                    }
    }   
}
Community
  • 1
  • 1
M.A.Murali
  • 9,988
  • 36
  • 105
  • 182

1 Answers1

0

You should always save the zoom level at the end of the onCameraChange, otherwise you are always comparing to 0 and therefore it will always count as zoom.

X.X_Mass_Developer
  • 717
  • 1
  • 8
  • 23
  • in the myMethod() I do some operation, do not change the zoom level. so the camera listener called and the previous zoom equal to camera zoom, so that myMethod() is called twice. How do I prevent? – M.A.Murali Apr 17 '14 at 11:21