I can find some posts on how to warn user when the back button is
pressed to 'quit' the application.

http://groups.google.com/group/android-developers/browse_thread/thread/496500abe014f324/7bf02ce27368b9e6?lnk=gst&q=back+button+prevent#7bf02ce27368b9e6

http://groups.google.com/group/android-developers/browse_thread/thread/4f0393186d9297fb/1c228fbc9e43760d?lnk=gst&q=back+button+prevent#1c228fbc9e43760d

The common answer is to catch the key down event by onKeyDown, or use
startActivityForResult().

My approach is to restart the activity in onStop().

Handler stopHandler = new Handler()

void onStop() {
   // show a dialog to warn the user
   // when the user click 'OK', call the following ...
  stopHandler.post(new Runnable() {
    void run() {
       Intent myselfIntent = new Intent(....);
       startActivity(mySelfIntent);
   }
}
};

Is it a better choice?

Please help to check if there's anything inappropriate.



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