I need to do something when the user clicks the ImageButton I\'ve tried to create a static class that implements both OnClickListener
The onTouchListener is able to handle both movements.
Switch between event.action() values to obtain MotionEvent.
case MotionEvent.ACTION_DOWN: is the first finger impact.
case MotionEvent.ACTION_UP: is when the finger goes away.
You'll have to set the impact point on ACTION_DOWN.
TheImpactPoint=event.getX();
And then obtain the distance with ACTION_UP
float distance =TheImpactPoint-event.getX();
If distance = 0 then there is a click, otherwise it would be more or less than zero depending on gesture.
So this is the way to use the click event without a real click event and using only the onTouchListener.
Hope will be useful.