private void obtainBackground(@StyleRes final int themeResourceId) {
        TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                new int[]{R.attr.materialDialogBackground});
        int resourceId = typedArray.getResourceId(0, 0);

        if (resourceId != 0) {
            setBackground(resourceId);
        } else {
            setBackgroundColor(
                    ContextCompat.getColor(getContext(), R.color.dialog_background_light));
        }
    }
private void obtainBackground ( @ StyleRes final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogBackground } ) ; int resourceId = typedArray . getResourceId ( 0 , 0 ) ; if ( resourceId != 0 ) { setBackground ( resourceId ) ; } else { setBackgroundColor ( ContextCompat . getColor ( getContext ( ) , R . color . dialog_background_light ) ) ; } }
Obtains the background from a specific theme.

@param themeResourceId
The resource id of the theme, the background should be obtained from, as an {@link
Integer} value