Having a dialog popup asking "Do you really want to exit the application" seems to be bad karma. However, a toast stating "If you press Back again this will exit the app" seems to be less intrusive, and might be a better way to prevent accidental user actions. It may also depend on the current app state if you want to allow exiting the app or if you want to put the app into the background when the user presses "back" (or "home" for that matter)
On Monday, May 6, 2013 9:35:53 AM UTC-4, Piren wrote: > > Actually, even in earlier versions of Android the activity stack behavior > could be manipulated in ways you wouldn't expect using task reparenting and > etc. Basically in one instance back could bring you back to your app, in > others it can act like going "up" in that app...Google's example was > opening a Send Email activity which can have its Back button either go back > to your app, or go into the Inbox of that app. > > My guess is that all this confusion is why they created the Action Bar and > give you the option to make it more consistent by making a distinction > between what Back is and what Up is. > > As far as i recall, Google doesn't even recommend overriding the Back > button, pretty much for these exact reasons. But in your case (your app) > you need to override it if you plan on getting what you expect...The way > you described it is that you expect the Back button to navigate within you > app, but it seems like you never switch activities/fragments, you just > change the information displayed... so when pressing the Back button it > exists the app, since this is what should happen... your expectations are > actually the wrong ones, since this is not how you've implemented the app. > > > On Monday, May 6, 2013 3:52:40 PM UTC+3, Doug Gordon wrote: >> >> Excuse me for a minor rant, but is anyone else bothered by what I call >> the "overloading" of the Android Back key? What I mean by this is that >> pressing it can have two vastly different results: it can return you to >> an earlier "view" in the app you are using, or it can effectively exit >> the app and return to the previous app or home screen. >> >> In the original concept (?) of Android, this can work well. For example, >> you have an app with a "View on Map" control. Tap it and you throw out >> an Intent that's picked up by Google Maps. When you're done, you press >> the Back key and return to the original app. Fine. >> >> However -- and for me this is a big however -- many if not most apps are >> a lot more complex and are more in the nature of "standalone" programs. >> When running these apps, the Back key is used to back up to previous >> viewing states of the app, such as returning from an article to the >> table of contents. Trouble is, it's not always obvious or easy to >> remember the hierarchy of the app contents, and I don't know how many >> times I press the Back key expecting to return to another state of the >> app and instead find myself looking at the home screen! >> >> An example: The user runs a weather app and it displays the weather for >> her location. She decides to look at the weather in another city and >> uses some control to select it. At this point it is easy to assume that >> pressing the Back key will return the app to the previous city's data, >> but that's not how it works: pressing that key exits the app. >> >> My own app has this situation, and even when using it myself I sometimes >> accidentally exit it instead of going "back" to an earlier set of >> details. I notice that some apps have put in an "Are you sure you want >> to exit?" dialog that helps prevent this, but it would seem it would be >> a lot cleaner if this were not necessary. >> > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

