//Set button color to red Button1.setBackgroundColor(0xFFFF0000); Button2.setBackgroundColor(Button11.getContext().getResources().getColor(R.color.red)); // The button is in activity Button3.setBackgroundColor(getResources().getColor(R.color.red));Source:www.lautturi.com