1

I have a Password Dialogue and, to prevent "peeking", I would like to hide the screen behind the window.

The best I could come up with was the following code to Blur the screen's contents:

    Window window = dialog.getWindow();
    LayoutParams layoutParams = window.getAttributes();
    layoutParams.dimAmount = 1.0f;
    layoutParams.flags = layoutParams.flags | WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
    window.setAttributes(layoutParams);

Unfortunately, while this works fine on the majority of devices, on certain Motorola devices this causes a terrible slowdown of the screen composing to the point where the password entry field is unusable. (Yes, I verified this is the cause, as removing the blurring code fixes the slowdown.)

Anyways, I would like to find a way to make the screen behind the dialog blank (or any solid color). I had been unable to find a solution to this.

Tom anMoney
  • 1,231
  • 1
  • 14
  • 29
  • Your dialog is an Activity, as far as I can tell. How about not giving it the dialog theme? – EboMike Feb 04 '12 at 06:36
  • As far as I can tell, there is no theme attribute that controls what happens to the screen behind a dialog. My dialog is not an Activity, it's a regular old "pop-up" Dialog. – Tom anMoney Feb 04 '12 at 06:59

1 Answers1

0

Why not just create a new full screen activity for your password entry? Then you can make it look however you want. Does it really have to be a dialog? If so, then start up a full screen "solid color" activity and then show the dialog.

dhaag23
  • 6,106
  • 37
  • 35
  • Well, to me a full screen activity with 1 text field on it just looks sloppy and unprofessional, especially on a tablet. Any other suggestions? There surely must be a way to do this... – Tom anMoney Feb 05 '12 at 02:06
  • @Tom That doesn't really make sense. You want something that erases the screen behind the dialog. In other words: You want to be in control of the entire screen, even on a tablet. So you want an activity. Of course, you have the option to draw a dialog or something in your activity to make it look more professional. – EboMike Feb 05 '12 at 02:56
  • Hmmm, I think you are right. I may have to redesign this portion of my app. Thanks! – Tom anMoney Feb 05 '12 at 14:31