Android examples for android.graphics:Color
format Color Int Hex String like #ff0000
import android.annotation.SuppressLint; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String formatColorInt2HexString(int c) { String s = ""; try {//from w ww.j a va 2 s .co m s = String.format("#%06X", (0xFFFFFF & c)); } catch (Exception e) { } return s; } }