Open In App

How to Set Up Processing for Android?

Improve
Improve
Like Article
Like
Save
Share
Report

Processing is a free graphical library and Integrated Development Environment (IDE) built for the electronic arts and visual design communities. It is one of the most powerful libraries available today for creating visual algorithmic artworks, both 2D and 3D. It is open-source, based on Java, and comes with a large variety of functions geared to making drawing and painting with code both fun and easy. We can create different types of arts using our coding skills example, games, animation and physics engine, etc.

Using Processing’s core library in your Android apps, you can create high-performance graphics and animations without dealing with Android’s OpenGL or Canvas APIs. Usually, you won’t even have to bother with low-level tasks such as managing threads, creating render loops, or maintaining frame rates. In this article, we will discuss how to set up Processing for Android. 

Step by Step Implementation

Step 1: Download Processing 3.0 for your operating system (OSX, Windows, or Linux) from this link.

Step 2: Extract The Zip file in any folder and open the processing.exe file.

Step 3: After the application opens click on the icon as shown below in image ‘Add More‘.

Step 4: Now install the Android Mode.

Step 5: Install Android SDK if you don’t have it on your computer.

After installation of Android SDK, our installation part of  Processing for android is done now we make our project on it.

Run-on the Device

Now for running on our device we have to keep our device in developer mode as we do in android and through USB.

Example Code:

Java




// Program to show moving Ball and changing colour.
 
// Set up variable position,colour and velocity.
PVector pos;
PVector vel;
int col;
 
// Function to set up size of canvas
// and position,velocity and colour.
void setup(){
  size(600, 600);
  pos = new PVector(width/2, height/2);
  vel = new PVector(random(-4, 4), random(-4, 4));
  col = floor(random(0, 255));
}
 
// Function to draw eclipse.
void draw(){
  background(col);
  fill(231);
  checkValid();
  fill(204, 102, 0);
  ellipse(pos.x, pos.y, 50, 50);
  pos.add(vel);
}
 
// Function to check the position
// of ball must be within screen.
void checkValid(){
  if(pos.x <= 25 || pos.x >= width - 25){
    vel.x *= -1;
     
    // Change in colour when it hit the wall.
    col = floor(random(0 ,255));
  }
  if(pos.y <=25 || pos.y >= height - 25){
    vel.y *= -1;
     
    // Change in colour when it hit the wall.
    col = floor(random(0 ,255));
  }
}


 
 

Output:

 

To Run on Emulator

 

To run on an Emulator we have to install it.

 

 

To see it is installed or not go to C:\Users\Documents\Processing\android\sdk there must be a folder name Emulator. To run click “Run on Emulator“.

 

 

In console:

 

 

Output:

 

Note: If you can’t able to run on the emulator then open processing.exe in administrator mode. 

 



Last Updated : 10 Nov, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads