how to display alert message when some one clicks on back button

by manoj » Tue, 27 Jan 2009 21:12:01 GMT


Sponsored Links
 Hi friends,

I want to display an alert asking "do you want to exit from the
application yes/no?" before exiting the application (when we click the
Back button).

Can any one please help me how to achieve this?

Thanks,
Manoj.
--~--~---------~--~----~------------~-------~--~----~



how to display alert message when some one clicks on back button

by Mark Murphy » Tue, 27 Jan 2009 21:12:33 GMT


 


Probably you will want to use AlertDialog, perhaps created using the
AlertDialog.Builder class.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


how to display alert message when some one clicks on back button

by manoj » Tue, 27 Jan 2009 21:17:54 GMT


 can you please show me the sample code?





--~--~---------~--~----~------------~-------~--~----~



how to display alert message when some one clicks on back button

by Tommaso » Wed, 11 Mar 2009 16:27:47 GMT


 Mark,

that works for Alerts if you have only ONE activity in your app.
For example purpose it is great. For real life it is misguiding.

I couldn't find a solution yet.
How do you show AlertDialog from a subactivity!?

Ciao,
  Tommaso





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. scrolling listview loses background color/drawable

It happens to android emulator, on xp as i know.

I depress mouse pointer to scroll a listview. While it scrolls, the
background drawable disappers. When i release the mouse, the
background still disappear till i move mouse to touch the screen.

This is a harmless issue but makes me uneasy.

--~--~---------~--~----~------------~-------~--~----~

2. Applications

Hi,

I was just wondering if there have been any applications created for
either the 0.9 version or the 1.0 - the latter preferred.

Thanks,
Anu
--~--~---------~--~----~------------~-------~--~----~

3. format for progressbar drawable xml?

4. GridView: how to select, programmatically?

5. java.lang.VerifyError in Android

6. When ever i run a mail application, ANdroid emulator say sorry (process google.com.android )stops unexpectedly

7. Nokia & Visa tie up...