Question: I defined a white color in mycolors.xml under res/values as below:

```
<?xml version="1.0" encoding="utf-8"?>
<resources> 
<color name="my_white">#ffffffff</color>
</resources>

```

In my code, I set the text color of a TextView as the white color I defined:

```
TextView myText = (TextView) findViewById(R.id.my_text);
myText.setTextColor(R.color.my_white);

```

But the text in the TextView turned out to be a black color.

When I use @color/my\_white in layout xml files, it works fine. 

I check the generate R.java, and see:

public static final int my\_white=0x7f070025;

Did I miss something?

Thanks.

Answer: 
Based on the [Android developer docs](http://developer.android.com/guide/topics/resources/more-resources.html#Color), it looks like your reference should be:

```
myText.setTextColor(R.color.my_white);

```

ETA: As noted in Mayra's answer, R.id.my\_white is probably returning a reference to the object that represents your colour rather than the ARGB value of the colour.
What you are providing setTextColor currently is the id of the my\_white object, not the color my\_white. I think what you want is `R.color.my_white`.