Android: Dynamically Change TextView Background color

Below is snippet might help you where txtChannelName is an object of TextView

 txtChannelName.setBackgroundColor(Color.RED);

or

txtChannelName.setBackgroundColor(Color.parseColor("#ffffff"));

yow can set color from android or color in format rbg like this:

TextView txtView = (TextView) findViewById(R.id.yourId);
txtView.setBackgroundColor(Color.parseColor("#AA3456"));

or:

txtView.setBackgroundColor(Color.BLUE);

You can try:

String color = "FF0000";   // For example your color is FF0000
TextView txt = new TextView(this);         
txt.setBackgroundColor(Integer.parseInt(color, 16)+0xFF000000);

OR

//This is the most preferrable
txt.setBackgroundColor(Color.parseColor("#FF0000"));