The CommonsBlog

BACK Means Back

One of these days, I’m going to stop following StackOverflow, just because it saddens me so much.

Today’s head-exploding example is “I need to override the back button to launch a context menu”.

People. This isn’t a hard concept. When it comes to sex, “no” means no. When it comes to UX, BACK means back.

(let’s ignore the “use context menu as arbitrary UI construct” anti-patten for the moment)

Now, BACK may not mean “destroy the current activity”, which is the default behavior. It might need to be adjusted for the particulars of an activity, such as how the fragment system allows the user to reverse FragmentTransactions via the BACK button. Or, perhaps BACK might mean “dismiss the popup the user triggered previously”.

But, regardless, BACK means back.

Pressing the BACK button should take the user logically to whatever preceded it without hesitation. At most, it might trigger a confirmation dialog, if the user was in an activity and did a lot of data entry and might have accidentally bumped BACK. But that’s a relatively rare case.

There is no selection involved with “back” — it is whatever logically preceded it. Pressing BACK is not a request from the user to “take me someplace” — it is a request from the user to take the user back, period. If you want to offer navigation to other places, use an action bar and put navigation buttons in it, or use the options menu. Pressing BACK should not be popping up some sort of selection dialog, let alone a context menu.

I feel fairly confident that if, in an iOS app, you tried popping up a selection list when the user tapped the on-screen “Back” button, that you would be rejected from the App Store for violating the Apple Human Interface Guidelines. Perhaps Amazon will start rejecting apps for screwball stuff like this, the way they reject apps that block the main application thread.

I really wish that the Android Market had hooks for third-party non-profit testing services to help validate app quality. Such services would issue badges for those who meet UX guidelines, pass certain security and privacy tests, etc. That way, Google would not have to do the “heavy lifting” of the actual testing, but would merely pass along the results of the tests to prospective users, much like how appliance manufacturers use Underwriters Laboratories to certify that their gadgets are unlikely to spontaneously combust. Such badges could go a long way towards steering developers to “do the right thing”.

So, override onBackPressed() if you need to, but ensure that whatever you implement, BACK means back.

Need a speaker at your Android development meetup? Mark Murphy is available, in person in the Boston/Pittsburgh/DC triangle, or by remote anywhere in the world! Contact Mark for details!