Code example for Resources.Theme

Methods: resolveAttribute

0
    /** 
     * Resolves the given attribute id of the theme to a resource id 
     */ 
    public static int getAttribute(Theme theme, int attrId) {
        final TypedValue outValue = new TypedValue();
        theme.resolveAttribute(attrId, outValue, true);
        return outValue.resourceId;
    } 
 
    /** 
     * Returns the resource id of the background used for buttons to show pressed and focused state 
     */ 
    public static int getSelectableItemBackground(Theme theme) {
        return getAttribute(theme, android.R.attr.selectableItemBackground);
    } 
 
    /** 
     * Returns the resource id of the background used for list items that show activated background 
     */ 
    public static int getActivatedBackground(Theme theme) {
        return getAttribute(theme, android.R.attr.activatedBackgroundIndicator);