• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps converting hexadecimal to integer

vihaari71

Lurker
There is a problem to parse 0xFFFFFF88 into integer. can anyone help me to resolve this problem..

The main issue is to render colors from database which are like #E7E9E7 with datatype as TEXT. I need to convert them as integer to use them in
.mDrawable.getPaint().setColor(integer);

Please help me out..

Thanx in advance,
Vihaari
 
Welcome to Android Forums! I'll move this post to the Developer's section.
 
Hi,
I have Hexadecimal value and need to assign to a button's background by setBackgroundColor(),but getting Runtime Exception: see the code snippet below with exception output. Please help me resolve this

String strColor="0xFFF3ECE0";
int intColor= Integer.parseInt(strColor,16);
button1.setBackgroundColor(intColor);

ERROR/AndroidRuntime(874): java.lang.NumberFormatException: unable to parse '0xFFF3ECE0' as integer
 
Thanx for the support...

I could solve the problem by just changing the values like if the value is #ffff00,
i changed it to 0xffffff00..
This is working as it is geting converted into decimal from haxadecimal..

If any hexadecimal is there just add 0xff in the place of # to make it work as a decimal format one..
 
Back
Top Bottom