Try dismissing it in onPause() out it is visible...
On Jul 23, 2012 6:48 PM, "Brad Justice" <bradleypjust...@gmail.com> wrote:

> I am creating an AlertDialog in my activity onResume with the following
> code:
>             LayoutInflater li =  LayoutInflater.from(this) ;
>             View view = li.inflate(R.layout.welcome,null);
>             AlertDialog.Builder builder = new AlertDialog.Builder(this);
>             builder.setTitle("Welcome to StreamHold");
>             builder.setView(view);
>             welcome = builder.create();
>             welcome.show();
>
> The dialog has an exit button. When clicked the following code executes in
> the onClick listener:
>             welcome.dismiss();
> and normally the dialog disappears. This fails, however, if while the
> dialog box is displayed I press the power button to blank the display and
> then press it a second time to restore. In this case, the dismiss fails.
> Repeated pressing of the exit button will re-execute the dismiss(), but the
> box remains visible and the exit button is still active. I have attempted
> various workarounds: replacing dismiss() with cancel(); adding hide();
> requesting focus for the underlying window; various experiments with
> invalidating the underlying layout and the layout of the dialog box.. None
> of these have worked. If, however,  you tap the exposed portion of the
> underlying window or press the back button the dialog box does disappear.
>
> Am I doing something wrong here, or is this a known issue?
>
> Thanks,
>
> Brad Justice
>
> I have reproduced this on a Nexus 7 running 4.1.1.
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to