get System Attribute Drawable - Android Graphics

Android examples for Graphics:Drawable Operation

Description

get System Attribute Drawable

Demo Code


//package com.java2s;
import android.content.Context;

import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable getSystemAttrDrawable(Context context, int attr) {
        TypedArray a = context.obtainStyledAttributes(new int[] { attr });
        Drawable d = a.getDrawable(a.getIndex(0));
        a.recycle();// www  . j a v a 2s .com
        return d;
    }
}

Related Tutorials