I have just tried to do like
System.out.println("color == " + Color.parseColor("#F5F5F5"));
then it returns like
color == -657931
anyone knows why, please?
First of all parseColor
method will return an integer representation of the hexadecimal F5F5F5
which is actually FFF5F5F5
+ the opacity of the color.
the decimal value of FFF5F5F5
is 4294309365
which is then converted to integer that will overflow thus giving your that negative number.
here is an example of that overflow
int i = (int)4294309365L; //4294309365L the decimal representation of FFF5F5F5
System.out.println(i); //result: -657931
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With