2

Does anyone have any idea why getPressure() returns always 1.0?

Here is my code:

@Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);

        System.out.println(event.getPressure());

        return true;

    }
Rohit Malish
  • 3,209
  • 12
  • 49
  • 67

2 Answers2

2

Does anyone have any idea why getPressure() returns always 1.0?

The typical touchscreen / input device has no way to measure pressure. You either don't press and get no touch event or you press and get a touch event with value 1.

zapl
  • 63,179
  • 10
  • 123
  • 154
  • 2
    That is not true. Touchscreen devices can calculate pressure basing on size of contact area, which works well for fingers. – Skiba Apr 29 '14 at 06:59
  • @Skiba +1 I guess I was wrong about that. Capacitive and resistive touchscreens can determine an area / strength but for values other than 1 and 0 to appear they have to evaluate and expose that data from touchscreen to low level driver to highlevel `TouchEvent`. And several simply don't do that. – zapl Apr 30 '14 at 08:55
0

https://groups.google.com/forum/#!topic/android-developers/10pF8EUEuy0 Here's an answer about how getPressure and getSize() work in Android, I think this would help

Master_Yi
  • 179
  • 1
  • 1
  • 10