• 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
Nov 15, 2010
5
0
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
 
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
 
Upvote 0
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..
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones