Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.AttrRes; public class Main { public static boolean resolveBoolean(Context context, @AttrRes int attr, boolean fallback) { TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { attr }); try { return a.getBoolean(0, fallback); } finally { a.recycle(); } } public static boolean resolveBoolean(Context context, @AttrRes int attr) { return resolveBoolean(context, attr, false); } }