How To Fling Up, Down, Left, Right In Android Using GestureDetector

Here is an effective class I use to detect gestures in Android devices such as flinging in any direction whether it is up, down, left or right using a GestureDetector.

I found this class in the illusionsandroid website and modified it a little to suit my requirements such as changing the value to at least detect a bit of a long fling rather than a short one.

To use the class. do it like this.

And, in your onTouch() method as I am sure your Activity implements the OnTouchListener, use the flingListener like this:

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *