Code example for GestureDetectorCompat

0
            OnTouchListener {
 
        private GestureDetectorCompat detector;
 
        public TagDetector(Context context) {
            detector = new GestureDetectorCompat(context, this);
        } 
 
        @Override 
        public boolean onSingleTapUp(MotionEvent e) {
            float locationX = getXPercent(e.getX()); // mRootView.getWidth();
            float locationY = getYPercent(e.getY());
            createTag(null, locationX, locationY);
            Log.d(TAG, "Tap on screen");
            return super.onSingleTapConfirmed(e);
 
        } 
 
        @Override 
        public boolean onTouch(View v, MotionEvent event) {
            detector.onTouchEvent(event);