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.
> 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+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> 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+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
On Tuesday, 24 July 2012 08:47:04 UTC+8, Brad Justice 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.
On Mon, Jul 23, 2012 at 7:47 PM, Brad Justice <bradleypjust...@gmail.com>wrote:
> The dialog has an exit button.
First suggestion would be to replace your layout button that calls dismiss
with a standard dialog button that does this automatically. See if that
helps.
--------------------------------------------------------------------------- ----------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices
On Monday, July 23, 2012 6:44:05 PM UTC-7, MagouyaWare wrote:
> Try dismissing it in onPause() out it is visible...
>> 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.