I am a beginner in Android. I need to swipe only from left to right and to do not swipe from right to left. For this what I want to do? All the examples are showing both left to right and right to left?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take a look at the accepted solution here – Fling gesture detection on grid layout
The solution explains how to implement a simple gesture listener, and record left to right and right to left swipes. The relevant code from the example is in the GestureDetector
onFlingoverride method. Basically, if point 1 (e1) minus point 2 (e2) is greater than a set minimum swipe distance, then you know it’s right to left. If point 2 (e2) minus point 1 (e1) was greater than the minimum swipe distance then it’s left to right.