Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static int parseColorFromString(String color) {
        int colorInt;
        if (color != null && !color.isEmpty() && !color.substring(0, 1).equals("#")) {
            colorInt = Color.parseColor("#" + color);
        } else {
            colorInt = Color.parseColor(color);
        }
        return colorInt;
    }
}