- // Remove the warning below that `getWindow()` might be null.
- assert alertDialog.getWindow() != null;
+ // Get the alert dialog window.
+ Window dialogWindow = alertDialog.getWindow();
+
+ // Remove the incorrect lint warning below that the dialog window might be null.
+ assert dialogWindow != null;