Code example for Context

Methods: getResources

0
     * @param resId The resource identifier pointing to the icon's Bitmap 
     * @param normalColor The color used to color the icon in normal mode 
     * @param altColor The color used to color the icon in alternative mode 
     */ 
    public ActionBarDrawable(Context context, int resId, int normalColor, int altColor) {
        this(context, context.getResources().getDrawable(resId), normalColor, altColor);
    } 
 
    /** 
     * Create a new ActionBarDrawable using the specified Drawable. 
     *  
     * @param context The Context used to retrieve resources (Bitmap/theme) 
     * @param d The icon's Drawable (should be a BitmapDrawable) 
     * @param normalColor The color used to color the icon in normal mode 
     * @param altColor The color used to color the icon in alternative mode 
     */ 
    public ActionBarDrawable(Context context, Drawable d, int normalColor, int altColor) {
        // TODO Cyril: Should use a Bitmap instead of a Drawable ... 
        super(context.getResources(), (d instanceof BitmapDrawable) ? ((BitmapDrawable) d).getBitmap() : null);
        mNormalCf = new LightingColorFilter(Color.BLACK, normalColor);
        mAltCf = new LightingColorFilter(Color.BLACK, altColor);
    } 
 
    private static int getColorFromTheme(Context context, int attr, int defaultColor) {