couldn't be able to set color from colors.xml file



in order to keep all the colors in one place i copied all my colors in a colors.xml file,



<resources>

<color name="footerColor">#FF607675</color>
<color name="activityBackground">#FFB7D4E1</color>
<color name="listView1">#FFB7D3E1</color>
<color name="listView2">#FFC5DCE7</color>
<color name="title">#AA4C4E44</color>
<color name="subTitle">#FF013C3B</color>

</resources>


but when I am setting this color in my .java file then they are not working,


like this,



date.setTextColor(color.subTitle);


but If i am hard coding the color then it is working,



date.setTextColor(0xFF013C3B);


I have also tried providing the complete path to my Resources file like this, but this doesn't work either



date.setTextColor(com.news.testapp.R.color.subTitle)


It is not showing error or anything but it doesn't work either. What am I doing wrong ?


No comments:

Post a Comment