Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.annotation.Nullable; import android.util.TypedValue; public class Main { @Nullable public static Drawable getAttributeDrawable(Context context, int attributeId) { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(attributeId, typedValue, true); return context.getResources().getDrawable(typedValue.resourceId); } }