I am also facing the same problem today. And, as of today, the Android document says that the setInverseBackgroundForced() API is deprecated and recommends that the developer specify the window background using the warning dialog box theme.
Note. An exception should ideally not stop a function from working.
However, I didnโt want to investigate why it doesnโt work today, and switched my attention to making everything an cleaner and more recommended way for Android documents. And this is something like the code below:
private final int DIALOG_THEME_STYLE = android.support.v7.appcompat.R.style.Base_Theme_AppCompat_Dialog_MinWidth; AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this, DIALOG_THEME_STYLE);
Hope this helps!
source share