code: public static Drawable getDrawableAttr(Context ctx, @AttrRes int drawableAttrId){
          int[] attrs = new int[] { drawableAttrId /* index 0 */};
          TypedArray ta = ctx.obtainStyledAttributes(attrs);
          Drawable drawable = ta.getDrawable(0);
          ta.recycle();
          return drawable;
      }
docs: Get a Drawable attribute value
  
  @param ctx
  @param drawableAttrId
  @return