Code example for TypedValue

Methods: resolveAttribute

    protected Drawable getActionBarBackground(Context context) {
        int[] android_styleable_ActionBar = {android.R.attr.background};
        // Need to get resource id of style pointed to from actionBarStyle 
        TypedValue outValue = new TypedValue();
        context.getTheme().resolveAttribute(android.R.attr.actionBarStyle, outValue, true);
        // Now get action bar style values... 
        TypedArray abStyle = context.getTheme().obtainStyledAttributes(outValue.resourceId,
        try { 
            // background is the first attr in the array above so it's index is 0. 
            return abStyle.getDrawable(0);
        } finally { 
    protected int getActionBarSize(Context context) {
        int[] attrs = {android.R.attr.actionBarSize};
Contextual code suggestions in your IDE  Get Codota for Java