title: Using MaterialAlertDialogBuilder with a material theme
body: <p>I have set the android application to use the material theme</p>
  
  <pre><code>&lt;style name="AppTheme" parent="AppTheme.Base"&gt;&lt;/style&gt;
  
  &lt;style name="AppTheme.Base" parent="Theme.MaterialComponents.Light.DarkActionBar"&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
          &lt;item name="drawerArrowStyle"&gt;@style/DrawerArrowStyle&lt;/item&gt;
          &lt;item name="android:textColorSecondary"&gt;@android:color/white&lt;/item&gt;
          &lt;item name="android:textColorHint"&gt;@android:color/darker_gray&lt;/item&gt;
          &lt;item name="searchViewStyle"&gt;@style/SearchViewStyle&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>In my activity/fragment, I am trying to invoke the material alert dialog</p>
  
  <pre><code>new MaterialAlertDialogBuilder(mAppContext)
                              .setTitle("Title")
                              .setMessage("Message")
                              .setPositiveButton("Ok", null)
                              .show();
  </code></pre>
  
  <p>At runtime this is throwing the following IllegalArgumentException exception</p>
  
  <pre><code>java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
          at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:240)
          at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:211)
          at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:146)
          at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:78)
          at com.google.android.material.dialog.MaterialDialogs.getDialogBackgroundInsets(MaterialDialogs.java:55)
          at com.google.android.material.dialog.MaterialAlertDialogBuilder.&lt;init&gt;(MaterialAlertDialogBuilder.java:116)
          at com.google.android.material.dialog.MaterialAlertDialogBuilder.&lt;init&gt;(MaterialAlertDialogBuilder.java:102)
          at com.syl.app.fragments.AlarmNotificationDetailFragment$2.onClick(UserFragment.java:265)
          at android.view.View.performClick(View.java:5207)
          at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:941)
          at android.view.View$PerformClick.run(View.java:21177)
          at android.os.Handler.handleCallback(Handler.java:739)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:148)
          at android.app.ActivityThread.main(ActivityThread.java:5441)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
  </code></pre>
  
  <p>Isn't this contradictory? A material component requires AppCompat theme whereas the application uses a material theme.</p>
  
  <p>The android documentation also says the same</p>
  
  <pre><code>MaterialAlertDialogBuilder requires that your application use a Material Components theme (e.g., Theme.MaterialComponents.Light). Using a Material Components theme with MaterialAlertDialogBuilder will result in an AlertDialog that matches your appplication’s color, typography, and shape theming.
  </code></pre>
  
  <p>How do I get the alert dialog to work in this case where I am using a material theme?</p>