Android - TextView setting the background color dynamically doesn't work

Setting the background color programatically of an android TextView doesn't seem to work. I'm I missing something!

TextView et = new TextView(activity); 
et.setText("350"); 
et.setBackgroundColor(R.color.white); 

I also have this file (colors.xml) in my res/values folder
 
<resources> 
        <color name="white">#ffffffff</color> 
        <color name="black">#ff000000</color> </resources> Also, setting the text color causes the TextView to disappear.
 
TextView c1 = new TextView(activity); 
c1.setTextColor(R.color.solid_red); 
c1.setText("My Text"); 

Popular Posts