Question

I have implemented SimpleOnGestureListener.onFling(), but I have to fling very fast to trigger it. Is there any way to make it more sensitive?

Thanks in advance...

Was it helpful?

Solution

The sensitivity or "oomph" needed to trigger an onFling() event is checked here in GestureDetector:

if ((Math.abs(velocityY) > mMinimumFlingVelocity)
        || (Math.abs(velocityX) > mMinimumFlingVelocity)){
    handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
}

Sadly there is no existing method to change the private member mMinimumFlingVelocity. However you should be able to copy the entire GestureDetector class into a new class in your project and hard code a new value yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top