Monday, April 18, 2011

[android-developers] Re: Detecting BACK button press on AlertDialog

"Using dismiss listeners

If you'd like your application to perform some procedures the moment
that a dialog is dismissed, then you should attach an on-dismiss
listener to your Dialog.

First define the DialogInterface.OnDismissListener interface. This
interface has just one method, onDismiss(DialogInterface), which will
be called when the dialog is dismissed. Then simply pass your
OnDismissListener implementation to setOnDismissListener().

However, note that dialogs can also be "cancelled." This is a special
case that indicates the dialog was explicitly cancelled by the user.
This will occur if the user presses the "back" button to close the
dialog, or if the dialog explicitly calls cancel() (perhaps from a
"Cancel" button in the dialog). When a dialog is cancelled, the
OnDismissListener will still be notified, but if you'd like to be
informed that the dialog was explicitly cancelled (and not dismissed
normally), then you should register an
DialogInterface.OnCancelListener with setOnCancelListener()."

This something along the lines your looking for?

Available since API level 1 so no problems with compatibility.

http://developer.android.com/guide/topics/ui/dialogs.html

http://developer.android.com/reference/android/content/DialogInterface.OnDismissListener.html

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate