Code example for GestureDetector

0
	@Override 
	protected void init() { 
		super.init(); 
		mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
		mGestureListener = getGestureListener();
		mGestureDetector = new GestureDetector(getContext(), mGestureListener);
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
			mScaleListener = getScaleListener();
			mScaleDetector = new ScaleGestureDetector(getContext(), mScaleListener);
		} 
		mCurrentScaleFactor = 1f;
		mDoubleTapDirection = 1;
	} 
 
	@Override 
	protected void onBitmapChanged(final Drawable drawable) {
		super.onBitmapChanged(drawable);
 
		final float v[] = new float[9];
		mSuppMatrix.getValues(v);
		mCurrentScaleFactor = v[Matrix.MSCALE_X];