How to detect swipe left or right function on listview item in android

ANDROID (1)

If you want to detect swipe gesture from left to right or right to left on the list view item in android. than you just have to add this Class in your activity and perform any task by detecting any type of gesture in your list item in android. Follow the instruction given below to achieve this functionality in you listview.

This is the Class which you have to add in your activity

 

  1. public static enum Action {
  2. LR, // Left to right
  3. RL, // Right to left
  4. TB, // Top to bottom
  5. BT, // Bottom to top
  6. None // Action not found
  7. }
  8. public class SwipeDetector implements View.OnTouchListener {
  9. private static final int HORIZONTAL_MIN*DISTANCE = 30; // The minimum
  10. // distance for
  11. // horizontal swipe
  12. private static final int VERTICAL_MIN_DISTANCE = 80; // The minimum distance
  13. // for vertical
  14. // swipe

Read full blog at our highly specific C, Java, PHP, Javascript, iPhone, android developer forum about the topic described above “How to detect swipe left or right function on listview item in android“. You can also learn much more about different programming technologies and can enhance your tech skills.

 

How to detect swipe left or right function on listview item in android