I am so glad neither of you suggested overriding onBackPressed() or
intercepting the BACK key code via onKeyDown()!

After all, neither option is a good idea except for rare cases. Then
again, Dianne did a pretty good job of describing how to do it in
those rare cases (among other things) in
http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.html.
But this post focuses on 2.0 and up.

On Feb 22, 8:10 am, TreKing <[email protected]> wrote:
> On Tue, Feb 22, 2011 at 3:46 AM, dashman <[email protected]> wrote:
> > How can I detect if the user has pressed the BACK button
> > (i.e. closed the dialog).
>
> On Tue, Feb 22, 2011 at 4:07 AM, Miguel Morales <[email protected]>
>
>  wrote:
> > Set an ondimiss listener.
>
> You probably want a cancel listener. Dismiss is called whenever the dialog
> goes away, even if a selection is made. Cancel is only called when the
> dialog is explicitly canceled (user pressed Back or cancel() was called on
> the Dialog).
>
> --------------------------------------------------------------------------- 
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to