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 trialBen Holland
Courses Plus Student 4,062 PointsMy color wheel has an error and i dont why ?
heres the code for my ColorWheel.java
package com.ben.funfacts.funfacts;
import android.graphics.Color;
import java.util.Random;
/**
* Created by stevenphillips on 05/11/14.
*/
public class ColorWheel {
// Member Variables
public String mColors[] = {
"#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
};
// Method ability
public int getColor() {
String color = "";
// Randomly Select Fact
Random randomGenerator = new Random(); // Construct new Random generator
int randomNumber = randomGenerator.nextInt(mColors.length);
// Facts
color = mColors[randomNumber];
int colorAsInt = Color.parseColor(color);
return colorAsInt;
}
1 Answer
Gloria Dwomoh
13,116 PointsHi again Ben, your code seems fine but you have missed a brace in the end. Try adding a "}" in the end and see if that helps.
Ben Holland
Courses Plus Student 4,062 PointsThanks that fixed it !!!!
Ben
Gloria Dwomoh
13,116 PointsYou are welcome :)
Gloria Dwomoh
13,116 PointsGloria Dwomoh
13,116 PointsI fixed your code a bit. To learn how to markdown code in the forum you can check out the video on the right side :)