11

On the Android, is the expected action of the back button to navigate backward through menus, or does it just go "back" to the previous screen you came from?

I don't have an Android device to sample a number of applications to see what the norm is. I'm using phonegap to package an HTML5 app, so I need to manually handle any back button functionality.

5 Answers 5

11

The default behavior is to go to the previous screen no matter what it is.

  • If you're deep in the menu then it takes you up a level.
  • If you're in the top level of a menu it takes you back to the application.
  • If you're in the main screen of an application it takes you either to the desktop or to the app, from which you launched the current one (e.g. from browser back to RSS reader).

For detailed information, see Task and Back Stack, Activity and Task Design Guidelines, and other topics about BACK button in Android Dev guide.

3
  • 3
    Some Google apps don't do this. I find it infuriating when I'm in messaging in a particular conversation (having come there from a notification), hit back, and it takes me to the home screen. I then open messaging again, it takes me to the same conversation, hit back again and it finally takes me to messaging home. Incredibly, incredibly annoying.
    – fredley
    Commented Jan 10, 2012 at 9:38
  • Interesting. I use Android of CyanogenMod flavor on a tablet so I've never interacted with the messaging app.
    – dnbrv
    Commented Jan 10, 2012 at 14:50
  • 2
    @fredley That's because that's how the back button is supposed to work. The back button is not an "up" button. I'll repeat that. The back button is NOT an "up" button. If I'm playing a YouTube video, a notification comes in, and I touch to view that single message, the back button should NEVER take me back to the list of conversations. It should (and usually does) take me right back to where I was: watching a video. In your case, it was the home screen. (BACK != UP) is the very foundation of multitasking on Android. Commented Jan 10, 2012 at 18:04
7

dnbrv and Pewpewarrows have it exactly right, but to point to the most definitive resource on the matter, the Android Design Guide says this:

The Up button is used to navigate within an application based on the hierarchical relationships between screens. For instance, if screen A displays a list of items, and selecting an item leads to screen B (which presents that item in more detail), then screen B should offer an Up button that returns to screen A.

If a screen is the topmost one in an app (i.e. the home of the app), it should not present an Up button.

The system Back key is used to navigate based on the history of screens the user has recently seen, in reverse chronological order—in effect, the temporal relationships between screens.

When the previously viewed screen is also the hierarchical parent of the current screen, pressing the Back key will have the same result as pressing an Up button -- this is a common occurrence. However, unlike the Up button, which ensures the user remains within your app, the Back key can return the user to the Home screen, or even to a different application.

Back vs Up in Android navigation

This guide is new, but it is the best source for understanding how navigational patterns (and all other Android design constructs) should be applied to apps.

2

One more thing - if you're on the main screen of the App and there's no previous screen that you can go back to, pressing back button will close the app.

This is actually the only way to completely close the app. Silly pattern, as there is no warning in most of the apps (I've started to use alert box to let know user that it's going to shut down the app).

5
  • Err. I definitely overlooked this. As soon as the user enters the app, I turned off the back button. I haven't released an update yet, so this is a huge catch. Commented Jan 10, 2012 at 16:07
  • If you display an alert to me when I'm trying to close your app, the very next thing I'm going to do is uninstall your app. The only possible reason I could see putting that in is if I'm on the very last step of a mission-critical action. Your app should gracefully handle being backgrounded. Not to mention that there is no such thing as traditionally "closing" an application on Android. Activities are either moved into the background or foreground based on user input. Sure, they can be killed through a task manager (or the recent apps menu in 4.0+), but that's not normal workflow behavior. Commented Jan 10, 2012 at 18:07
  • Through my own lack of understanding, I didn't show an alert. I just immediately bound to do nothing. It's an HTML5 phonegap app, so everything is manual. This work is directly based off of requests to "Make the android back button work", so I understand the importance of getting this right. Commented Jan 11, 2012 at 3:22
  • @Pwepewarrows mind that if the app is going to be closed by hitting the back button I don't want to do it by accident. That's why alert can be saving. In my experience only hardcore Android fans know about strange function of back as a 'close app' (basing on qualitative tests). Commented Jan 11, 2012 at 7:19
  • 2
    @marcintreder: The back button normally should never terminate the app, Android apps should never bother the user about starting or terminating the app, instead it should give the illusion that the app is never terminated. If an app still has activities that requires any user input, and the OS decides to terminate your app, the app should save its current state and automatically restore it when the user comes back to the application later. Android fans do not know about the function of back as a close app because that's not the normal, expected behavior of apps.
    – Lie Ryan
    Commented Jan 17, 2012 at 9:53
1

The expectation is that it acts as a global history within an app -- you can use it to go back from as many levels deep into a menu as you need to (and some apps will take you right back to the home screen that way, without exiting the app).

0

There is an option on android that affect this behavior. Under Developer options there is the option

"Do not keep activities"

If this is checked, then app instances are destroyed when they loose visability

Drove me crazy for a while, beieve me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.