code: private void obtainHeaderBackground(@StyleRes final int themeResourceId) {
          TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                  new int[]{R.attr.materialDialogHeaderBackground});
          int resourceId = typedArray.getResourceId(0, 0);
  
          if (resourceId != 0) {
              setHeaderBackground(resourceId);
          } else {
              setHeaderBackgroundColor(
                      ThemeUtil.getColor(getContext(), themeResourceId, R.attr.colorPrimary));
          }
      }
docs: Obtains the background of the dialog's header from a specific theme.
  
  @param themeResourceId
  The resource id of the theme, the background should be obtained from, as an {@link
  Integer} value