I have a custom view derived from View. I\'d like to be notified when the view is clicked, and the x,y location of where the click happened. Same for long-clicks.
L
Thank you. That was exactly what I was looking for. My code now is:
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
textView.setText("Touch coordinates : " +
String.valueOf(event.getX()) + "x" + String.valueOf(event.getY()));
}
return true;
}
});
which does precisely what Mark asked for...