Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get the point/coordinate the user clicked on an android view?

I have an imageview and when clicked, calls OnClickListener.onClick(View v). How do I get the exact point/coordinate that the user clicked?

Thanks

like image 734
Bruce Lee Avatar asked Sep 07 '10 09:09

Bruce Lee


1 Answers

You can't get the coordinate touched in OnClickListerner. Please use OnTouchListener.onTouch(View v, MotionEvent event) instead of it, and you could get the coordinate from the event.

like image 126
Jett Hsieh Avatar answered Nov 02 '22 23:11

Jett Hsieh