code: private View inflateHeader() {
          if (getRootView() != null) {
              if (header == null) {
                  LayoutInflater layoutInflater = LayoutInflater.from(getContext());
                  header = (ViewGroup) layoutInflater
                          .inflate(R.layout.material_dialog_header, getRootView(), false);
                  headerBackgroundImageView = header.findViewById(R.id.header_background_image_view);
                  headerContentContainer = header.findViewById(R.id.header_content_container);
                  headerDivider = header.findViewById(R.id.header_divider);
              }
  
              headerContentContainer.removeAllViews();
  
              if (customHeaderView != null) {
                  headerContentContainer.addView(customHeaderView);
              } else if (customHeaderViewId != -1) {
                  LayoutInflater layoutInflater = LayoutInflater.from(getContext());
                  View view =
                          layoutInflater.inflate(customHeaderViewId, headerContentContainer, false);
                  headerContentContainer.addView(view);
              } else {
                  LayoutInflater layoutInflater = LayoutInflater.from(getContext());
                  View view = layoutInflater
                          .inflate(R.layout.header_icon_image_view, headerContentContainer, false);
                  headerContentContainer.addView(view);
              }
  
              View iconView = headerContentContainer.findViewById(android.R.id.icon);
              headerIconImageView = iconView instanceof ImageView ? (ImageView) iconView : null;
              return header;
          }
  
          return null;
      }
docs: Inflates the dialog's header.
  
  @return The view, which has been inflated, as an instance of the class {@link View} or null,
  if no view has been inflated