-2

I want set event when user touch and sliding right -> left: -> " I want set 'Next' event", and sliding left -> right: -> "I want set 'Previous' event". .. in Linerlayout Can you helps me! Thanks so much

1 Answers1

0

I implemented this in an app for Cupcake (1.5) using the GestureDetector.OnGestureListener's onFling event. Using the results from that can tell you in what direction a user was dragging their finger when they did a quick swipe, but a slow sliding motion doesn't work very well. There are many other gestures supported via that interface, and I'm sure one will suit your needs nicely.

Luckily there is now also a ViewPager class that (I think) will do exactly what you want it to do. The Android Developer blog has a great post about how to use it here.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120