If i defined a color in resources
#123456
it\'s possible
This is how I've done it:
String color = "#" + Integer.toHexString(ContextCompat.getColor (getApplicationContext(), R.color.yourColor) & 0x00ffffff);