I am trying to apply background color to button dynamically using color id in color resource file(color.xml).
btn.setBackgroundColor(R.color.green);
i also tried this
btn.setBackgroundColor(Resources.getSystem().getColor(R.color.green));
but its not working.
if i apply
btn.setBackgroundColor(Color.Green);
Its working.
But i need to apply color resource from color.xml file. Please let me know how i can do it.