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

MUZ141046 Munyaradzi Nhema
1,773 Pointsplease assist. setting text colors of foodLabel and drinkLabel
please advise accordingly
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);
drinkLabel = (TextView) findViewById(R.id.drinkTextView);
RelativeLayout mealLayout = (RelativeLayout) findViewById(R.id.mealLayout);
mealLayout.setBackgroundColor(Color.GREEN);
RelativeLayout foodLayout = (RelativeLayout) findViewById(R.id.foodLabel);
foodLabel .setBackgroundColor(Color.BLUE);
//RelativeLayout drinkLayout = (RelativeLayout) findViewById(R.id.drinkLayout);
//drinkLayout.setBackgroundColor(Color.GRAY);
}
}
2 Answers

Abdiaziz Abdullahi Abdulle
Full Stack JavaScript Techdegree Student 7,458 PointsHEY, you've one example done for you in the challenge which sets the backGroundColor, so you can take example from there and set the textcolor like this.
foodLabel.setTextColor(Color.BLUE);
and the second one, you just change the foodLabel and the .BLUE. hope it helps.

MUZ141046 Munyaradzi Nhema
1,773 Pointsthis is the BEST answer!...hehehe happy Coding indeed!!...such people mek the forum so exciting!

MUZ141046 Munyaradzi Nhema
1,773 Pointsthank you very much Abdiazz..
i actually managed to do it.. i changed the the color also for the drinklabel text as follows:
drinkLabel.setTextColor(Color.GRAY);
Just as you have shown me.
thanks a lot!

Abdiaziz Abdullahi Abdulle
Full Stack JavaScript Techdegree Student 7,458 Pointsyou're welcome and plz accept the answer as Best Answer ;) happy coding Nhema.
MUZ141046 Munyaradzi Nhema
1,773 PointsMUZ141046 Munyaradzi Nhema
1,773 Pointsput comments on the statements l added and also the lines before the comments above it are also ones l put