I get hexadecimal color values ββfrom the server (in this form #xxxxxx , example #000000 for black)
How do I convert this value to an integer?
I tried to do Integer.valueOf("0x" + passedColor.substring(1, passedColor.length())) to get even more hextastic 0x000000 result, but here it is not intepreted as int , any other suggestions?
I get the error message: 08-03 21:06:24.673: ERROR/AndroidRuntime(20231): java.lang.NumberFormatException: unable to parse '0x00C8FBFE' as integer
I use the Android SDK for my setBackgroundColor(int color) function, which accepts, as you might guess, an integer color value.
This is the OPPOSITE of this question: How to convert an integer of a color to a hexadecimal string in Android?
java android colors numberformatexception
CQM Aug 04 '11 at 1:00 2011-08-04 01:00
source share