get Text Color Secondary - Android Graphics

Android examples for Graphics:Text Color

Description

get Text Color Secondary

Demo Code


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

public class Main {
    public static final int TEXT_COLOR_SECONDARY = android.R.attr.textColorSecondary;

    public static ColorStateList getTextColorSecondary(Context context) {
        return getSystemAttrColor(context, TEXT_COLOR_SECONDARY);
    }// ww  w  .jav  a 2  s  . c  om

    public static ColorStateList getSystemAttrColor(Context context,
            int attr) {
        TypedArray a = context.obtainStyledAttributes(new int[] { attr });
        ColorStateList color = a.getColorStateList(a.getIndex(0));
        a.recycle();
        return color;
    }
}

Related Tutorials