Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Android Studio

public class ColorWheel {

public String[] colors = {
        "#39add1", // light blue
        "#3079ab", // dark blue
        "#c25975", // mauve
        "#e15258", // red
        "#f9845b", // orange
        "#838cc7", // lavender
        "#7d669e", // purple
        "#53bbb4", // aqua
        "#51b46d", // green
        "#e0ab18", // mustard
        "#637a91", // dark gray
        "#f092b0", // pink
        "#b7c0c7"  // light gray
};


public int getColor() {


    // the button was clicked , so update the fact TextView with a new fact
    //randomly select a fact

    Random randomGenerator = new Random();
    int randomNumber = randomGenerator.nextInt(colors.length);
    int color = Color.parseColor(colors[randomNumber]);

    return colors[randomNumber];

}

}

1 Answer

Can you please specify your question? Or is this not a question at all, but simply a comment?