Idea taken from Android: Blurring and dimming background windows from dialog. I\'m having trouble getting the content under my dialog to blur. When calling eula.getWindow(
getWindow()
is a method of the dialog class, not of the dialog builder. Your code should rather look like this:
AlertDialog dlg = eula.show();
WindowManager.LayoutParams lp = dlg.getWindow().getAttributes();
lp.dimAmount = 0.0F;
dlg.getWindow().setAttributes(lp);
dlg.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
Note though that the FLAG_BLUR_BEHIND
constant is deprecated now, blurring behind windows is no longer supported. So your code might break in the future.
eula
is the Builder, not the dialog itself. Try:
final AlertDialog eulaDialog = eula.create();
eulaDialog.show();
WindowManager.LayoutParams lp = eulaDialog.getWindow().getAttributes();
lp.dimAmount = 0.0F;
eulaDialog.getWindow().setAttributes(lp);
eulaDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);