How can i detect which way i user swipes the picture if they swipe it right then (DO SOMETHING) if they swipe it left then (DO SOMETHING)
Asked
Active
Viewed 676 times
0
-
http://stackoverflow.com/questions/937313/android-basic-gesture-detection – fluffy Sep 21 '11 at 20:28
1 Answers
0
you can get the array of screen touch locations from event.getX(x) (for example event.getX(0) means latest motion event and getX(1) means previous to latest). In this you can apply a formula to detect in which side are you swiping.
For Right.. { if(event.getX(0)- event.getX(1) > 0) // You swiped to right } and similarly for left (i.e. xxxxxx < 0).

Awais Tariq
- 7,724
- 5
- 31
- 54