Default behaviour of the Back button

by Dexter's Brain » Fri, 18 Sep 2009 02:08:17 GMT

Sponsored Links

I am confused, as to what the default behaviour of the back button is,
as far as the Android platform is concerned.

For example, in the Contacts Application, if I am creating a contact,
I just key in a name, and the press back button, the contact is saved
with only the name. Fair enough. But, I then edit this contact to
include a phone number and press back button. This contact is updated
which now includes the phone number. I again edit this contact. This
time I remove the name, as well as the phone number and press the back
button. I get a message saying, "Contact doesn't exist".  In this
case, it deletes the contact. :(

In the mail appllication, while composing, when I press back, it goes
to the drafts folder. Thats good. But, if I just have to cancel this,
and I don't want this to go to drafts folder. For this, I have to open
the menu, and select "Cancel".

Is there any guideline for the back button, as to how should it

Waiting for your comments and suggestions.

Thanks and Regards,

Default behaviour of the Back button

by niko20 » Fri, 18 Sep 2009 04:05:41 GMT


The back button is really not meant to be "cancel" usually, but only
to exit the current screen you are working on.


Sponsored Links

Default behaviour of the Back button

by Dianne Hackborn » Fri, 18 Sep 2009 07:12:57 GMT

 The other key point is that generally our model is for data to be
edit-in-place, so pressing back from something like contacts will close the
screen but retain your edits (since the edits were performed as you did

There will always be exceptions -- I think gmail confirming you want to
cancel your message if you haven't yet saved it as a draft is a good one
because otherwise you unintentionally end up with a lot of drafts -- but
what you see in contacts is the general model.

We do need to get UI guidelines out that describe all of this in much more
detail.  I know this has been an issue for a while.

Btw, the scenario of editing a contact and removing all data then pressing
back is an edge case that to me is consistent with the model -- the contact
has no more data, so it no longer exists.  When you press back you have
already made the edits that make it empty so it is now gone.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Default behaviour of the Back button

by Dexter's Brain » Fri, 18 Sep 2009 18:27:47 GMT

 Thanks for your answers.


Other Threads

1. Message get disappeared when add SingleChoiceItems to alert dialog

       I am working on android app. but i stuck at one point when i
tried to add SingleChoiceItems to alert dialog the alert message  gets
disapear.,i dont know why this happens here is my  code snippet.

                        builder.setSingleChoiceItems(alertChoices , -1, new
DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface 
dialog, int which) {
                                                // TODO Auto-generated method 


                                        new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                                int id) {
                                        dialogRunning = false;
      I want to add both message and singlechoiceitems to  alert

thanks in advance



2. Main Angry Birds ga perlu HH Smartphone lagi, cukup pakai browser

Nah, RR mungkin sudah ada yang tahu, just info aja buat yang belum
Angry Birds bisa dimainkan di browser Google Chrome dengan cara
menginstallnya dari Chrome WebStore.
Lumayan buat yang ga ada gadget buat maininnya :D


3. bind service in another aplication

4. Rotate Image on bases of Velovity + GestureListener

5. Aw: (2nd try) Segmentation fault when loading a certain class from an OSGi framework under Android 2.2 & 2.3

6. Debugging errors in Eclipse

7. Setting the browser's user agent