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

Joe Guida
1,421 PointsCannot Resolve Symbol getColor
Here is my code from ColorWheel
public int getColor() {
// The button was clicked, so update the fact label with a new fact.
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;
}
}
And here is the code from FunFactsActivity.java
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
String fact = mFactBook.getFact();
factLabel.setText(fact);
int color = mColorWheel.getColor;
relativeLayout.setBackgroundColor(color);
showFactButton.setTextColor(color);
}
};
On the line int color = mColorWheel.getColor; there is an error on getColor that says Cannot resolve symbol getColor. I thought it was due to an import statement but I have already imported android.graphics.Color;
2 Answers

David Postlethwaite
9,355 PointsJoe, because your calling a method from the class colorwheel you have to use () i.e.
int color = mColorWheel.getColor();
Rebecca Rich
Courses Plus Student 8,592 PointsIs mColorWheel a ColorWheel object? If so, try int color = mColorWheel.getColor();
getColor() is an object method, so it must be called on an instance of an object and it must include the () for the method call.
David Postlethwaite
9,355 PointsDavid Postlethwaite
9,355 Pointsin your .OnClickListener listener