Code example for GestureDetectorCompat

0
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mWindowManager.getDefaultDisplay().getSize(mDisplaySize);
    mWindowParams = createWindowParams(INITIAL_WIDTH, INITIAL_HEIGHT);
    mIsOnLeft = true;
 
    mGestureDetector = new GestureDetectorCompat(context, new GestureListener());
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
 
    // TODO: don't hardcode cameraId '0' here... figure this out later. 
    mCamera = Camera.open(0);
    CameraPreview.setCameraDisplayOrientation(context, 0, mCamera);
 
    mPreview = new CameraPreview(context);
    mPreview.setCamera(mCamera);
    mPreview.setOnTouchListener(this);
 
    mRootView = mPreview;
  } 
 
  public void show() { 
    mWindowManager.addView(mRootView, mWindowParams);