I was wondering, does anyone know what are the Android equivalents to [event allTouches] and event.timestamp found in iOS? I am working on a multi-touch gesture recognizer for Android, and would like to know what are Android's equivalents to those iOS calls.
Asked
Active
Viewed 157 times
0
-
It might help if you explained exactly what you're trying to get, for those not versed in iOS... – PearsonArtPhoto Mar 19 '14 at 19:06
-
Basically, `[event allTouches]` returns an array of all the touches on the screen. `event.timestamp` is the time when a touch has began, ended, or moved. – Pink Jazz Mar 19 '14 at 19:23
1 Answers
0
First of all, your best bet is to read the Android SDK documents. Essentially, touches in Android are managed by setting an OnTouchListener
to a view, and managing from there. The OnTouchListener has a single function, OnTouchEvent
, which follows the following format:
public boolean onTouch(View v, MotionEvent event) {
Inside the MotionEvent
, there is data on every finger placed. There are things like getX(int )
, getY(int )
and getPointerId(int )
. Also, the status is listed. Anything you want to do you can do from that.

PearsonArtPhoto
- 38,970
- 17
- 111
- 142
-
Okay, this answers my question about getting the different pointers on the screen, however, how do I get a timestamp on when a touch has began, ended, or moved? – Pink Jazz Mar 19 '14 at 19:48
-
You don't get a timestamp for free, what you have to do is keep track of your own timestamp when you first detect the `POINTER_DOWN` action. – PearsonArtPhoto Mar 19 '14 at 19:49