4

I have a ListView with onItemClick() method . Now I want to detect a touch motion in the screen . Implementing onTouchEvent() does not work in this case since I have written already a click listener . So help me how to do it. I need both the on click listener and onTouchEvent().

Adil Soomro
  • 37,609
  • 9
  • 103
  • 153
arul
  • 190
  • 2
  • 15

1 Answers1

5

You need to implement the OnTouchListener(View v, MotionEvent event) to check event.getX() and event.getY() when event.ACTION_DOWN and event.ACTION_UP and compare them to know the motion direction.

Note: you must return true to be able to receive the event.ACTION_UP event.

Mohamed_AbdAllah
  • 5,311
  • 3
  • 28
  • 47