If i defined a color in resources
#123456
it\'s possible
For API above 21 you can use
getString(R.color.color_name);
This will return the color in a string format. To convert that to a color in integer format (sometimes only integers are accepted) then:
Color.parseColor(getString(R.color.color_name));
The above expression returns the integer equivalent of the color defined in color.xml file