So i’m having a problem with using decimal colors in android.
I’m getting color codes from an external database.
For Example:
- 16777215 is white
- 16711680 is red
Now I want to use this colors to create a GradientDrawable.
int color = myDbReader.getColor(); //returns the decimal color code
new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[] {color, 0 });
The code example produces always a completley white gradient object.
I tried to google how to convert the decimal colors in the right way.. But i didn’t find anything.
Can anyone give me a hint how to use the decimal colors in the right way?
So based on your suggestions I spent last night with reading about the different types of Color codes and finally found the solution:
The given numbers are access color codes so i only have to:
Thanks four your help!