Processing for Android

backPressed

Use this function to handle the back press event. If it is not implemented, the sketch will quit when a back press is detected.


void setup() {
  fullScreen();  
}

void draw() {
  background(#00FF70);
}

void backPressed() {
  if (millis() < 5000) {
    println("Don't leave so soon!");
  } else {
    println("Bye");
    exit();
  }
}