Reputation: 51
In my application I want to detect the types of finger pressed against the screen.The types of touch may be single touch OR multi touch.I searched a lot,but could not find anything.
Is there any way to find the types?
Upvotes: 1
Views: 861
Reputation: 17820
There's no possible way to know which finger is at a certain point, but you can certainly get the locations of each touch event. Given MotionEvent, you can do this:
int pointerId = event.getPointerId(0);
int pointerIndex = event.findPointerIndex(pointerId);
float x = event.getX(pointerIndex);
float y = event.getY(pointerIndex);
The pointerId is unique to each finger touching the screen.
From there you'd need to do some sophisticated analysis to guess the finger(s). If there's only one finger touching the screen, it's probably the index finger. If there are two, it would be reasonable to guess that it's an index finger and thumb or an index and middle finger, depending on how the touches are moving; If they're getting closer or farther, it's likely the index + thumb. If there are 3 fingers, it's probably index + middle + ring, etc.
Really, something along that line is the the best you can do, and it certainly wouldn't be very accurate.
Upvotes: 1
Reputation: 549
it's impossible to know which types of finger the users did (thumb, index ...), but you can detect a single/multi touch. this may help you.
Upvotes: 0