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 {

    private static int parserColor(String value) {
        String regularExpression = ",";
        if (value.contains(regularExpression)) {
            String[] temp = value.split(regularExpression);

            int color = Color.parseColor(temp[0]);
            int alpha = Integer.valueOf(temp[1]);
            int red = (color & 0xff0000) >> 16;
            int green = (color & 0x00ff00) >> 8;
            int blue = (color & 0x0000ff);

            return Color.argb(alpha, red, green, blue);
        }
        return Color.parseColor(value);
    }
}