# About screen pressure sensitivity

**URL:** <https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987>\
**Category:** Processing for Android\
**Created:** [February 21, 2020, 10:56pm UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987 "2020-02-21T22:56:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tayyarare](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@tayyarare](https://discourse.processing.org/u/tayyarare)\
**Post date:** [February 21, 2020, 10:56pm UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987/1 "2020-02-21T22:56:06Z")

</div>

Hi there,  
I want to use screen touch pressure about size or opacity.Is it possible?  
I can’t reach pressure sensor or something else.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 24, 2020, 9:09am UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987/2 "2020-02-24T09:09:20Z")

</div>

Hi @tayyarare  
I enabled ‘show pointer’ in the input section of the software developer bar, acessable in the android settings.  
Then you can see on the top of the screen the coordinates and also the touch screen pressure as well as the touch size. On my device I can’t read the touch pressure, but the touch size I can.  
With code below however I get an NullPointerException  
@akenaton Do you have any idea?

```auto
import android.view.MotionEvent; 

MotionEvent pressure;
MotionEvent touchSize;
float ts = 1;

void setup() {
  size(200, 200);
  fill(0);
  textSize(33);
  textAlign(CENTER);
  //float press = pressure.getPressure();
}

void draw() {
  background(255);
  if (mousePressed) {
    try {
      ts = touchSize.getSize();
    } 
    catch (Exception e) {
      e.printStackTrace();
    }
  }
  text(str(ts), width/2, height/2);
}

```

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 24, 2020, 5:49pm UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987/3 "2020-02-24T17:49:19Z")

</div>

@noel ===  
my idea is: when ever you pretend to use some sensor you have to know wether it is or its not present in your phone:: so you have to list alll sensors, which is easy… (i must add that in a lot of cases they are not present)

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 24, 2020, 6:18pm UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987/4 "2020-02-24T18:18:58Z")

</div>

Thanks, good idea; I will implement it.  
About the error do you also have an ldea?  
Becaue the touchSize can be used.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 26, 2020, 4:29pm UTC](https://discourse.processing.org/t/about-screen-pressure-sensitivity/17987/5 "2020-02-26T16:29:30Z")

</div>

@noel ===  
Sorry, as i am travelling i cannot test but looking to the error code i suppose that the mouse event is not recognized as a touchEvent by android and touchSize is always null; if i am right you have to use gestureDetector. I ll do that asap and put the code.
