What is the difference between setOnClickListener and setOnTouchListener?
Interms of:
Edited:
Thanks
setOnTouchListener gives you a chance for something to respond before the view does, whereas. setOnClickListener is fired after the view responds. Follow this answer to receive notifications.
How does setOnClickListener do in android? In Android, the OnClickListener() interface has an onClick(View v) method that is called when the view (component) is clicked. The code for a component's functionality is written inside this method, and the listener is set using the setOnClickListener() method.
OnTouch is Motionevent. You can drag up,down,left and right. But OnClick is simply focusing,pressing and releasing. When you want to get co-ordinates of screen where you touch the screen, use touchlistener. Just a click event for button and imageview,use OnClickListener.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With