Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.support.annotation.AttrRes; import android.util.TypedValue; public class Main { static int resolveColorAttribute(Context context, @AttrRes int resId, int fallback) { TypedValue value = new TypedValue(); boolean colorFound = context.getTheme().resolveAttribute(resId, value, true); return colorFound ? value.data : fallback; } }