FutureZeng
FutureZeng

Reputation: 39

Converting the colors in decompiled Android

How do we convert the colors in decompiled android?

For example: we decompile the apk android, the last to use jd-gui view. Class files, and found the decompiled int color = -65536;

What is the original (hexadecimal) color in this case? How do we convert hexadecimal -65536 to the originally defined color (format 0x1ABCDE)?

Upvotes: 2

Views: 181

Answers (2)

GianluKa
GianluKa

Reputation: 83

The color comes from the android.graphics.Color class:

http://developer.android.com/reference/android/graphics/Color.html#RED

Upvotes: 0

arnorhs
arnorhs

Reputation: 10429

You mean just for knowing which color it is? Or just to get it into the same format simply for printing the value of it?

One way would be use the built in Integer.toHexString() method:

String hex = Integer.toHexString(-65536);

// output is probably something like: ffff0000

But it's a string. The fact of the matter is that the -65536 value is actually the color. You can assign it to something to see that it actually works.

Upvotes: 1

Related Questions