The application never "quits," and so onDestroy() won't be called when the
user pushes the back button (it will be called when Android kicks your
process out of memory).  Instead you would want to override onPause coming
from a press of the back button.

A better solution would be to realize that the application simply doesn't
quit, so asking the user if they're sure they want to quit is silly: since
this won't happen even if they push the back button...

Kris

On Tue, Nov 27, 2012 at 4:15 PM, Subodh Nijsure <subodh.nijs...@gmail.com>wrote:

> Hi,
>
> I want to present a yes/no dialog when user enters back, on main activity
> 'are you sure you want to quit? ' And if they click ok, quit the
> application.
>
> To do this I show a dialog in onDestroy() that asks yes/no question but
> that doesn't work. What is correct way to implement 'are you sure you want
> to quit the application' dialog?
>
> -Subodh
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to