code: private void obtainButtonTextColor(@StyleRes final int themeResourceId) {
          TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                  new int[]{R.attr.materialDialogButtonTextColor});
          ColorStateList colorStateList = typedArray.getColorStateList(0);
  
          if (colorStateList != null) {
              setButtonTextColor(colorStateList);
          }
      }
docs: Obtains the button text color from a specific theme.
  
  @param themeResourceId
  The resource id of the theme, the color should be obtained from, as an {@link
  Integer} value