parse Color from String to int - Android Graphics

Android examples for Graphics:Color Value

Description

parse Color from String to int

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {

    public static int parseColor(String colorStr) {
        int color = 0xff000000;
        try {//  w w w .j a  va2  s.co  m
            color = Color.parseColor(colorStr);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return color;
    }
}

Related Tutorials