Code example for Resources

Methods: getDrawable

0
    } 
 
    public void setDrawable(Resources res, int resId) {
        // Note we explicitly don't set mResourceId to resId since we allow the drawable to be 
        // swapped at runtime and want to re-use the existing resource id for identification. 
        Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
        // Mutate the drawable so we can animate shared drawable properties. 
        mDrawable = drawable != null ? drawable.mutate() : null;
        resizeDrawables(); 
        setState(STATE_INACTIVE);
    } 
 
    public TargetDrawable(TargetDrawable other) {
        mResourceId = other.mResourceId;
        // Mutate the drawable so we can animate shared drawable properties. 
        mDrawable = other.mDrawable != null ? other.mDrawable.mutate() : null;
        resizeDrawables(); 
        setState(STATE_INACTIVE);
    } 
 
    public void setState(int [] state) {