Colorwheel
Colorwheel
1 package com.example.alanayoub.csumbfunfacts;
2
3 import android.graphics.Color;
4
5 import java.util.Random;
6
7 public class ColorWheel {
8 // fields (Member variables) - Properties about the object
9 public String[] mColors = {
10 "#39add1", // light blue
11 "#3079ab", // dark blue
12 "#c25975", // mauve
13 "#e15258", // red
14 "#f9845b", // orange
15 "#838cc7", // lavender
16 "#7d669e", // purple
17 "#53bbb4", // aqua
18 "#51b46d", // green
19 "#e0ab18", // mustard
20 "#637a91", // dark gray
21 "#f092b0", // pink
22 "#b7c0c7" // light gray
23 };
24
25 // Methods - Actions the object can take
26 public int getColor() {
27 String color;
28 // Randomly select a fact
29 Random randomGenerator = new Random();
30 int randomNumber = randomGenerator.nextInt(mColors.length);
31 color = mColors[randomNumber];
32 int colorAsInt = Color.parseColor(color);
33
34 return colorAsInt;
35 }
36 }
37