Processing for Android

orientation()

Call this function in setup() to fix the orientation of the phone to landscape or portrait and avoid auto-rotate (which restarts the app):


void setup() {
  orientation(LANDSCAPE);    
}

void draw() {
  background(255);
  line(0, 0, width, height);
  line(0, width, 0, height);  
}
                

void setup() {
  orientation(PORTRAIT);    
}

void draw() {
  background(255);
  line(0, 0, width, height);
  line(0, width, 0, height);  
}