get System Attribute Color - Android Graphics

Android examples for Graphics:Color Operation

Description

get System Attribute Color

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;

public class Main {
    public static ColorStateList getSystemAttrColor(Context context,
            int attr) {
        TypedArray a = context.obtainStyledAttributes(new int[] { attr });
        ColorStateList color = a.getColorStateList(a.getIndex(0));
        a.recycle();/*from  w w  w  . j  av  a 2s. co  m*/
        return color;
    }
}

Related Tutorials