How to Convert colors from Hex to RGB
android, colors
Solution
Edit: This was accepted as the answer but have a look at @johann's answer too, it will leave you and those reading your code less confused.
If you want to learn about the underlying representation of colours, you could start here.
Original answer:
`getColor()` gives you the colour as an ARGB `int`.
int color = getResources().getColor(R.color.ItemColor1);
float red = (color >> 16) & 0xFF;
float green = (color >> 8) & 0xFF;
float blue = (color) & 0xFF;
float alpha = (color >> 24) & 0xFF;
Problem
I have color in the String.xml file like this `<color name="ItemColor1">#ffff992b</color>` how can i convert is into four variables ``` float Red; float Green; float Blue; float Alfa; ``` in Java Code? any one can help