Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Phil White
Courses Plus Student 9,519 PointsStuck on android improving our code challenge...
Let's continue to add color to MealActivity. In the onCreate() method, set the text color of foodLabel to Color.BLUE and then set the text color of drinkLabel to Color.GRAY.
And this is the code you start with
7 Answers

Steve Hunter
57,682 PointsThe GRAY
needs to be capitalised.

Phil White
Courses Plus Student 9,519 PointsThank you it worked!

Nathan Fox
Courses Plus Student 850 PointsfoodLabel.setTextColor(Color.BLUE); drinkLabel.setTextColor(Color.Gray); That's what I put and it worked for me. I hope this helps.

Juan Gallardo
1,566 PointsThis is what worked for me.
public class MealActivity extends Activity {
public TextView foodLabel;
public TextView drinkLabel;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_meal);
foodLabel = (TextView) findViewById(R.id.foodTextView);
foodLabel.setTextColor(Color.BLUE);
drinkLabel = (TextView) findViewById(R.id.drinkTextView);
drinkLabel.setTextColor(Color.GRAY);
RelativeLayout mealLayout = (RelativeLayout) findViewById(R.id.mealLayout);
mealLayout.setBackgroundColor(Color.GREEN);
}
}

Steve Hunter
57,682 PointsWhat do you need, Juan?

Steve Hunter
57,682 PointsTry something like, foodLabel.text.setTextColor(R.Color.BLUE);
Autocomplete will probably assist you too.
Steve.

Phil White
Courses Plus Student 9,519 PointsNope that didn't work, Thanks for trying to help tho

Steve Hunter
57,682 PointsSecond attempt ... foodLabel.setTextColor(Color.BLUE);

Phil White
Courses Plus Student 9,519 PointsNope still not working...

Steve Hunter
57,682 PointsI'm opening Eclipse now and will see what I can figure out. What error are you getting?

Phil White
Courses Plus Student 9,519 Pointsit just says "There is a compiler error. Please click on preview to view your syntax errors!"
and then in preview it says
./MealActivity.java:16: cannot find symbol symbol : variable Gray location: class Color drinkLabel.setTextColor(Color.Gray); ^ 1 error

Tom Spencer
7,713 PointsI was using = instead of a dot apparently it should have been a two coffee day today.
foodLabel = setTexColor(Color.BLUE); (SNAFU) Oddly enough when I put this foodLabel.setTextColor(Color.BLUE); all is good
Phil White
Courses Plus Student 9,519 PointsPhil White
Courses Plus Student 9,519 Points