Android examples for Graphics:Color Value
Convert String hex color value to int color
//package com.java2s; import android.graphics.Color; import java.util.regex.Pattern; public class Main { public static int HextoColor(String color) { // #ff00CCFF String reg = "#[a-f0-9A-F]{8}"; if (!Pattern.matches(reg, color)) { color = "#00ffffff"; }//from w w w .ja v a2s. c om return Color.parseColor(color); } }