Code example for ScaleGestureDetector

0
 
	public CommonGestures(Activity ctx) {
		mContext = ctx;
		mDoubleTapGestureDetector = new GestureDetectorCompat(mContext, new DoubleTapGestureListener());
		mTapGestureDetector = new GestureDetectorCompat(mContext, new TapGestureListener());
		mScaleDetector = new ScaleGestureDetector(mContext, new ScaleDetectorListener());
	} 
 
	public boolean onTouchEvent(MotionEvent event) {
		if (mListener == null)
			return false; 
 
		if (mTapGestureDetector.onTouchEvent(event))
			return true; 
 
		if (event.getPointerCount() > 1) {
			try { 
				if (mScaleDetector != null && mScaleDetector.onTouchEvent(event))
					return true; 
			} catch (Exception e) {
				e.printStackTrace();