Code example for GestureDetector

Methods: setIsLongpressEnabledsetOnDoubleTapListener

0
  
  public PushPinMapView(Context aContext, AttributeSet attrs) {
    super(aContext, attrs);
    context = aContext;
  
    gestureDetector = new GestureDetector((OnGestureListener) context);
    gestureDetector.setOnDoubleTapListener((OnDoubleTapListener) context);
    gestureDetector.setIsLongpressEnabled(true);
  } 
  
  // Override the onTouchEvent() method to intercept events and pass them 
  // to the GestureDetector. If the GestureDetector doesn't handle the event, 
  // propagate it up to the MapView. 
  public boolean onTouchEvent(MotionEvent ev) {
    if(this.gestureDetector.onTouchEvent(ev))
       return true; 
    else 
      return super.onTouchEvent(ev);
  } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE