I need to create a window that the user can tap. I need to know when the user starts tapping, stops tapping, if the user moves his finger keeping it down, and the exact coordinates of where he taps, and where he is moving his finger, in real time.
I cannot understand which widget is the best for this kind of activity: can someone give me a hint, please?
Thanks.
I need to create a window that the user can tap. I need to
Share
Any
View(including anyViewGroup) with an attachedOnTouchListenercan do what you’re looking for. In theACTION_DOWNevent, you can record where the tap occurred; in theACTION_MOVEevent, you can get the coordinate of the current pointer location.Simply attach an
OnTouchListenerto your view and handle it accordingly: