Android Build a Simple Android App with Java Improving Our Code Adding Colors

Setting text color

I don't know where I'm missing it
public class MealActivity extends Activity {

    public TextView foodLabel;
    public TextView drinkLabel;

    public void onCreate(Bundle savedInstanceState) {
        foodLabel.setTheTextColor (Color. BLUE);
        drinkLabel.setTheTextColor (Color.GRAY);

        foodLabel = (TextView) findViewById(;
        drinkLabel = (TextView) findViewById(;
        RelativeLayout mealLayout = (RelativeLayout) findViewById(;

1 Answer

The method for setting text color is not called setTheTextColor. It's called setTextColor.