0

I am implementing OnFling. It works only when the velocity is very high. Which means i need to move my finger very very fast so that the Fling will take place. this is the code:

SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        // TODO Auto-generated method stub
        Log.v("onDoubleTap: \n", e.toString());
        return super.onDoubleTap(e);
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,

        Log.v("on fling", "on fling");

        if ((e1.getY() < CARD_POSITION) && (e2.getY() < CARD_POSITION)
                && (Math.abs(e1.getX() - e2.getX()) > CARD_SWIPE_MIN)){       
            return super.onFling(e1, e2, velocityX, velocityY);

        } else {
            return false;
        }

    }

2 Answers2

1

see https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/GestureDetector.java, look for a field named mMinimumFlingVelocity

pskink
  • 23,874
  • 6
  • 66
  • 77
1

Try this, It works for me I avoided using GestureDetector and SimpleOnGestureListener, I done it with catching touch listnerby catching the position fron MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP.

Jithu
  • 1,478
  • 1
  • 13
  • 21