I needed to have a simple way to see if a gesture of swipe up, down, right or left had been carried out so I created this little class to help me out. I know that Android has the built in gesture recognition but this just seemed so much easier. You can easily attach a function to be called when a gesture has been detected and the minimum travel distance and diagonal offset can all be configured easily.
Example code to show one way to work with gestures at Android devices.
Swipe left, right, up and down to call different functions that changes the background color.
Swipe settings such as how much directional swipe is allowed and minimum swipe length can be set easily in the constructor of the gesture class.