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. A question about OpenGL SurfaceView in DEMO

In the demo of OpenGL,  there launch a thread with an endless circle
to draw the frame.
But I believe the modus waste lots of system resource, there are any
good modus?

2. Developing java backend with android front end?


I'm pretty new to this, but starting to figure things out.

I was under the impression that Android would be able to run Java
code, so I had the idea of developing an AIM application for Android
using AOL's Java back end (, and then
developing the front end to work with Android.  I've been having some
problems getting this to work.  When I run the back end as a Java app,
it works fine, and when I run the Android front end, it works well
too, but when I try to run the AOL code as part of my Android project
(in eclipse), I get this:

Error occurred during initialization of VM
        at java.lang.Throwable.nativeFillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(
        at java.lang.Throwable.<init>(
        at java.lang.Throwable.<init>(
        at java.lang.Error.<init>(

those overflows continue for 200+ errors.  I started looking around a
little and am starting to see that Android doesn't use a strict
version of Java, so Java apps might not run.  Have I been wasting my
time?  Is there any way to get this back end to run on Android?  Can
someone please explain the difference in the type of Java that Android
uses, and when a Java app would run/won't run?


3. MediaPlayer-Null pointer exception

4. Add more features on my application

5. cant send data to service???

6. Calling all Location Based Service developers - JAX08 Presentation

7. AlertDialog.Builder.setItem() using Cursor