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 trialBarry Snowe
51,277 PointsWhy is this producing a compiler error?
I am pretty sure this should work. What will it take to get the compiler to recognize the dot operator symbol (if I understand the compiler error log correctly...)?
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);
foodLabel.setBackgroundColor(Color.BLUE);
drinkLabel.setbackgroundColor(Color.GRAY);
}
}
Barry Snowe
51,277 PointsNever mind. I was mindlessly writing setBackgroundColor
when I needed to write setTextColor
. Problem existed between chair and keyboard.
1 Answer
Nkosinolwazi Moyo
9,588 Points☺
Barry Snowe
51,277 PointsBarry Snowe
51,277 PointsThis portion is my contribution to the challenge: