Colour Plate for Android

Colour Plate App for Android

I recently started to learn to create android apps and this is my first app for android. I am using Processing app which lets you create your application in various language including JAVA, Javascript, python and Android.

Code for the main program:

import java.util.Random; //import random library [1]

void setup()

size(480, 800); //canvas size
background(84, 213, 184); //Initial Bg color

//Text format for Welcome Text
fill(255, 255, 255);
text(“Welcome to Colour Plate”+”\n”, width/8, height/2);
text(“Tap Anywhere to Start”+”\n”, width/4, height/2+30);

//Developer detail at bottom-right corner of the screen
fill(0, 102, 153);
text(“by A Khadka – 2014”, width-250, height-20);

void draw() {

void mousePressed()

Random r = new Random(); //initialise the random object
int red = r.nextInt(254) + 1; //random range 1 – 255
int green = r.nextInt(254) + 1;
int blue = r.nextInt(254) + 1;

background(red, blue, green); //assign bg colour
textSize(32); //text size
fill(255, 255, 255); // fill in white colour
text(“Red: “+red+”\n”+”Green: “+green+”\n”+”Blue: “+blue, width/6, height/3); //display the text in the Red, Green and Blue and their values
String hex = String.format(“#%02x%02x%02x”, red, green, blue); // convert rgb to hex [2]
text(“Hex: “+hex, width/6, height/2+40); //display the text in the text field



End of Colour Plate App for Android



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s