thanks for the response, most helpful.
i don't actively dismiss the dialog at any point, therefore something
behind the button click must be doing it. i took a look in
android.internal.app.AlertController.java, and found that its click
listener calls the appropriate button handler, then sends
Just ran a quick test on my code and you're right! Sorry for the wrong info.
I've been manually calling dismiss() and cancel() on the dialogs I use. It's
been a while since I looked at that code and figured I was doing that
because I had to ... now this makes me wonder why I did it that way to
can't re-show the dialog in onClick(), because it's already shown. at
least that was true with 1.1, i should check it with a later SDK.
so either i do my validation in onDismiss(), or i get all fancy.
Just ran a quick test on my code and you're right! Sorry for the
wrong info. I've been
What if you call setCancelable(false) on the dialog? Will it still
auto-dismiss?
I would assume not and then you could do what you're trying to do and call
cancel() manually when you're done validating.
You can definitely post a message to a handler in the OnClick and then
show the dialog again when your Handler gets the message...
Jason Proctor wrote:
can't re-show the dialog in onClick(), because it's already shown. at
least that was true with 1.1, i should check it with a later SDK.
according to the docs, setCancelable() determines whether the back
key cancels the dialog.
it's not so much the cancel behaviour as the ok behaviour. if the
dialog didn't auto-dismiss on an OK click, then things would work a
lot easier.
well, i'm just going to write a wrapper class that does
Yeah, just ran a quick test and setting cancelable to false stills lets the
dialog be dismissed by a button press. Weird. This definitely feels
ass-backwards.
Well, the last thing I can think of is adding your own layout with an OK and
cancel button with Dialog.setView() and handle the clicking
well i already did the wrapper so :-)
thanks for your help on this one...
Yeah, just ran a quick test and setting cancelable to false stills
lets the dialog be dismissed by a button press. Weird. This
definitely feels ass-backwards.
Well, the last thing I can think of is adding your own
i never look forward to handling Android dialogs, maybe someone can
point me to a better way of doing it than i'm doing right now.
say i have a dialog which has one text field in it, and OK and Cancel
buttons. i make the dialog with AlertDialog.Builder, and set click
listeners on the buttons
when the dismiss listener fires, can i tell which button caused
the dismiss?
No - I don't think any of the buttons by default cause the dialog to be
dismissed. This happens when you call dismiss() or cancel() on the dialog or
the user presses the back button.
so in the click listener, i set a
10 matches
Mail list logo