Target behavior:
An AlertDialog appears. When the user presses the yes button, the
dialog disappears (thus displaying what's under it), a random amount
of time passes (1-5 seconds), and then a Toast message pops up.

What's actually happening:
The AlertDialog appears. When the user presses the yes button, a
random amount of time passes but the AlertDialog is still visible and
obscures the content behind the dialog. After the time has elapsed,
the dialog finally disappears and the Toast message appears as
expected.

Other relevant info:
- I'm using SystemClock.sleep() to wait the random amount of time.
- In my efforts to fix this, I've tried calling dismiss() on the
AlertDialog before calling the method containing SystemClock.sleep().
(I've tried calling dismiss() in a variety of other "upstream" places
as well, but that didn't help.)
- I've tried calling hide() before dismiss() in hopes that it would be
more responsive, but no dice.

Questions:
- Is there some way to force the AlertDialog to close/dismiss/hide at
a time of my choosing?
- Is there some way to force completion of any pending tasks before
SystemClock.sleep() is called?
- Am I perhaps using the wrong method to wait the 1-5 seconds? Is
there something better than SystemClock.sleep()?

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to