In a custom view how would it be possible to get how much of a finger touched the screen. In other words, to get if the user used the tip of his finger or a larger area. And then to be able to get each dimension of the rectangle.
Asked
Active
Viewed 3,446 times
2 Answers
8
event.getPointerCount()
method call gives you number of touch
Sample Code
@Override
public boolean onTouchEvent(final MotionEvent event)
{
System.out.println("Touch Count ="+event.getPointerCount());
return true;
}

Sunil Kumar Sahoo
- 53,011
- 55
- 178
- 243
-
Thanks Sunil, Could you tell me how can I zoom page when touched with two fingers? – azad Dec 12 '11 at 06:43
0
Hi I have done same thing in my project may be it is useful for some one. Below is the code:
boolean read = true;
int count = 0;
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = event.getAction() & MotionEvent.ACTION_MASK;
if(action == MotionEvent.ACTION_POINTER_UP)
{
if(read == true)
{
count = event.getPointerCount();
read = false;
}
if(event.getPointerCount() == count)
{
Toast.makeText(getApplicationContext(), Integer.toString(count), Toast.LENGTH_SHORT).show();
}
}
if(action == MotionEvent.ACTION_POINTER_DOWN)
{
count = 0;
read = true;
}
return true;
}

Rahul Vats
- 277
- 3
- 17