java - How to convert a color integer to a hex String in Android? -
i have integer generated android.graphics.color
the integer has value of -16776961
how convert value hex string format #rrggbb
simply put: output #0000ff -16776961
note: not want output contain alpha , have tried this example without success
the mask makes sure rrggbb, , %06x gives zero-padded hex (always 6 chars long):
string hexcolor = string.format("#%06x", (0xffffff & intcolor));
Comments
Post a Comment