Back to project page GADemo.
The source code is released under:
GNU General Public License
If you think the Android project GADemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pdro.gademo; // w w w . j a va 2s . com import android.app.Activity; import android.graphics.Color; import java.util.Random; public class ColorWheel extends Activity { // Member variable (properties about the object) public String[] mColors = { "#39add1", "#3079ab", "#c25975", "#e15258", "#f9845b", "#838cc7", "#7d669e", "#53bbb4", "#51b46d", "#e0ab18", "#637a91", "#f092b0", "#b7c0c7" }; // Method (abilities: things the object can do) public int getColor() { String color = ""; // Randomly select a fact Random randomGenerator = new Random(); // Construct a new Random number generator int randomNumber = randomGenerator.nextInt(mColors.length); color = mColors[randomNumber]; int colorAsInt = Color.parseColor(color); return colorAsInt; } }