The mask makes sure you only get RRGGBB, and the %06X gives you zero-padded hex (always 6 chars long):
String hexColor = String.format("#%06X", (0xFFFFFF & intColor));
More Related Contents:
- how to do substring of HttpResponse in android
- Substring a string from both end in java [duplicate]
- Read/Write String from/to a File in Android
- Converting A String To Hexadecimal In Java
- Subscript and Superscript a String in Android
- String comparison – Android [duplicate]
- Converting a string to an integer on Android
- How to escape % in String.Format?
- How to convert hex string to Java string?
- How to change color of the back arrow in the new material theme?
- Convert seconds value to hours minutes seconds?
- How do you pass a string from one activity to another? [duplicate]
- How to set background color of an Activity to white programmatically?
- Android Color Picker [closed]
- Fatal Error: Invalid Layout of java.lang.String at value
- How to get data from each dynamically created EditText in Android?
- Android – how to replace part of a string by another string?
- == and .equals() not working in java [duplicate]
- Android Color Notification Icon
- How to remove only trailing spaces of a string in Java and keep leading spaces?
- Android coding with switch (String)
- Convert a String of Hex into ASCII in Java
- Is it possible to change the text color in a string to multiple colors in Java?
- Android: Changing Background-Color of the Activity (Main View)
- How can I get the average color of an image?
- What’s the best way to check if a String contains a URL in Java/Android?
- Random element from string array [closed]
- How to convert hex string to float in Java?
- Android color picker to be included in the activity
- Compare two hex strings in Java?