android TextView: setting the background color dynamically doesn't work
Use et.setBackgroundResource(R.color.white);
Try this:
TextView c1 = new TextView(activity);
c1.setTextColor(getResources().getColor(R.color.solid_red));
c1.setText("My Text");
I agree that a color and a resource have the same type, but I also spend a few hours to find this solution.
To set red color:
textView.setBackgroundColor(0xfff00000);
Or
<color name="solid_red">#fff00000</color>
textView.setBackgroundResource(R.color.solid_red);