Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Detect Touch Pressure on capacitive touch screen?

I've heard of:

MotionEvent e;
float press = e.getPressure(...);

But this only returns 0 for no touch, and 1 when my finger touches the screen.

Is it possible to find a value for the amount of pressure your finger is putting on the screen with touch capacitive screens?

Or is my hunch correct that this will only work with resistive screens..?

like image 970
Loren Kuich Avatar asked Jul 09 '13 04:07

Loren Kuich


1 Answers

MotionEvent().getPressure(i) should return a value between 0 and 1 based on the "pressure" placed on the screen. In reality for capacitive screens it is the size of the capacitive object rather than literal pressure, but the concept is almost the same for fingers (fingers are squishy). Ranges higher than one may be returned depending on the calibration of the touchscreen.

If your screen is only returning 0 or 1, try testing on another device. Perhaps your screens driver simply does not return those values.

MotionEvent | Android Developers : getPressure()

like image 153
John Moffitt Avatar answered Sep 19 '22 18:09

John Moffitt