I\'m writing my own image viewer that enables users to swipe left\\right to see the next\\previous image. I want to animate the image change according to the fling velocity.
Don't use the velocity: it is not easy to use. A swipe to the right it is a + number, to the left it is a - number. You could these:
event1.getRawY()
event2.getRawY()
event1.getRawX()
event2.getRawX()
to determine if the swipe was left or right:
if the first event was more than the second, the person swiped to the left, but you can say if the last event was x
less than the first event, then the person's swipe was far enough and react to it. You can do the opposite for a swipe was to a right. Also, the onFling doesn't recognize small taps and just touches, so you can get away without comparing the distance velocity or length at all.