# The image kills the touch screen

**URL:** <https://discourse.processing.org/t/the-image-kills-the-touch-screen/45851>\
**Category:** Processing for Android\
**Created:** [February 27, 2025, 9:29pm UTC](https://discourse.processing.org/t/the-image-kills-the-touch-screen/45851 "2025-02-27T21:29:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AniManOtaku](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/animanotaku/32/18733_2.png) [@AniManOtaku](https://discourse.processing.org/u/AniManOtaku)\
**Post date:** [February 27, 2025, 9:29pm UTC](https://discourse.processing.org/t/the-image-kills-the-touch-screen/45851/1 "2025-02-27T21:29:33Z")

</div>

Well, I was programming and testing stuff and accidentally created an image that literally destroys the touch screen.

```auto
PImage img;
boolean draw=true;

void setup(){
    img=new PImage(min(width,height),min(width,height));
    img.loadPixels();
    for(int i=0;i<img.pixels.length;i++){
      if((i%img.width+i/img.width)%2==0)
      img.pixels[i]=color(255);
      else
      img.pixels[i]=color(0);
    }
    img.updatePixels();
}

void draw(){
  background(200);
  
  imageMode(CENTER);
  if(draw)
  image(img,width/2,height/2);
  
  fill(0);
  textSize(40);
  textAlign(CENTER,CENTER);
  text(touches.length,width*0.5f,height*0.2f);
  
  fill(0,0,255,100);
  noStroke();
  for(int i=0;i<touches.length;i++){
    ellipse(touches[i].x,touches[i].y,100,100);
  }
}

void keyPressed(){
  draw=!draw;
}

```

It’s basically just a checkered pattern of white and black pixels. But when I display it on the screen, the sensor stops working, not the program itself but the phone sensor.

I’m wondering why this is happening? Or maybe I’m the only one with this problem?

I’m using xiaomi redmi 7, android 10, miui 11.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 27, 2025, 10:06pm UTC](https://discourse.processing.org/t/the-image-kills-the-touch-screen/45851/2 "2025-02-27T22:06:16Z")

</div>

With a Samsung tablet I see a large gray band in the center of a portrait oriented screen with a zero (0) printed top center. Touches on the screen give a transient purple dot and the zero turns to a one (1). It seems to work reliably over a few minutes of repeated testing. Is that what you intended it to do?

---

<div class="post-metadata">

**Author:** ![AniManOtaku](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/animanotaku/32/18733_2.png) [@AniManOtaku](https://discourse.processing.org/u/AniManOtaku)\
**Post date:** [February 28, 2025, 5:39am UTC](https://discourse.processing.org/t/the-image-kills-the-touch-screen/45851/3 "2025-02-28T05:39:54Z")

</div>

It seems to be working fine for you. My screen just stops working. I can’t even open the notification bar or exit the app. The screen doesn’t show taps and it prints (0).
