Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.TypedValue;

public class Main {
    public static int getAttributedColor(Context context, int attr) {
        int[] set = { attr };
        TypedValue typedValue = new TypedValue();
        TypedArray a = context.obtainStyledAttributes(typedValue.data, set);
        int color = a.getColor(0, Color.WHITE);
        a.recycle();
        return color;
    }
}