Getting a simple gesture

So, this is half the practical and semi-tasking question.

First, if I just want to get a simple "fling right" (which will return to the previous step), should I implement OnGestureListener or do something with GestureOverlayView?

I am reading Fling gesture detection in a grid layout , and it looks like if I go with OnGestureListener, I will have to manually add a listener to all of my views. This is annoying, and I would like to add this functionality to many activities, so it would be nice if I could put all the logic in an autonomous function. So maybe GestureOverlayView would be preferable? But all the examples that I see for him are really complicated ... I do not want to make my own gestures. I just want a simple scroll / roll detection to be detected in the mode .

Secondly, if you are in favor of any position, can you post a simple example? Detecting Fling gestures on a grid layout is an extension of SimpleOnGestureListener that does not implement OnGestureListener, and I got a little stuck on the steps to actually set the gesture listener to listen to the views. As for GestureOverlayView, as I said, all I saw are complex examples of creating your own gestures.

+3
source share
1 answer

Suppose you had the opportunity to go through an example in Code Shogun: in onFling () you can call the finish () function instead of calling the ViewFlipper method.  http://www.codeshogun.com/blog/2009/04/16/how-to-implement-swipe-action-in-android/

, call finish() Activity

viewFlipper.setInAnimation(slideLeftIn);
viewFlipper.setOutAnimation(slideLeftOut);
viewFlipper.showNext();

, .

0

All Articles