Possible Duplicate:
Double Tap -> Zoom on Android MapView?
I have an Activity
that extends MapActivity
. I use Google Maps.
I need to zoom in by double clicking or double tapping.
Can someone help me with this?
I have already looked at the below, but they are not what I'm looking for.
Double Tap -> Zoom on Android MapView?
Fling gesture detection on grid layout
I realized that onTouchListener
is being called only once, why is that so?
// set Gesture
detector = new GestureDetector(new GestureReactor());
mapView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
System.out.println("Inside onTouch");
return detector.onTouchEvent(event);
}
});
I have private class:
private class GestureReactor extends SimpleOnGestureListener {
@Override
public boolean onDoubleTap(MotionEvent e) {
System.out.println("inside onDouble");
controller.zoomInFixing((int) e.getX(), (int) e.getY());
return super.onDoubleTap(e);
}
}
and
private GestureDetector detector;
Since you want a copy-paste answer, look here.
EDIT:
In my public class MainMap extends MapActivity
I have a field called private MyMapView mv;
I then made a class which extends MapView
like this:
public class MyMapView extends MapView
.
So you just make a new class which extends MapView
, copy-paste the code you found in the link in there, and use your new class
in your Activity which extends MapActivity
.
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