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

Nkosinolwazi Moyo
Nkosinolwazi Moyo
9,554 Points

Setting text color

I don't know where I'm missing it

MealActivity.java
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.setTheTextColor (Color. BLUE);
        drinkLabel.setTheTextColor (Color.GRAY);

        foodLabel = (TextView) findViewById(R.id.foodTextView);
        drinkLabel = (TextView) findViewById(R.id.drinkTextView);
        RelativeLayout mealLayout = (RelativeLayout) findViewById(R.id.mealLayout);
        mealLayout.setBackgroundColor(Color.GREEN);
    }
}

1 Answer

Yusuf Mohamed
Yusuf Mohamed
2,627 Points

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