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 trialmike LaBianca
Courses Plus Student 2,456 PointsTrying to change background color I know I'm close. my code relativeLayout.setBackGroundColor(Color.GREEN);
just need a little help
import android.os.Bundle;
import android.widget.TextView;
public class MealActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_meal);
TextView foodLabel = (TextView) findViewById(R.id.foodTextView);
TextView drinkLabel = (TextView) findViewById(R.id.drinkTextView);
RelativeLayout mealLayout = (RelativeLayout) findViewById(R.id.mealLayout);
relativeLayout.setBackGroundColor(Color.GREEN);
}
}
2 Answers
Jon Kussmann
Courses Plus Student 7,254 PointsHi Mike,
You are indeed close. It should be:
mealLayout.setBackGroundColor(Color.GREEN);
In the previous line you called your RelativeLayout "mealLayout". So when you want to do stuff to that RelativeLayout, you refer to its name "mealLayout"
I hope this helps.
mike LaBianca
Courses Plus Student 2,456 Pointsyea i just figured out i was messing up on the caps, thanks for the help.
mike LaBianca
Courses Plus Student 2,456 Pointsmike LaBianca
Courses Plus Student 2,456 Pointsi tried that and it's still saying theirs a mistake, i don't know why.
Jon Kussmann
Courses Plus Student 7,254 PointsJon Kussmann
Courses Plus Student 7,254 PointsI should have been a little more careful.
It is setBack*groundColor, not setBackG*roundColor.