6 Answers
6

If you exit the app using the BACK button then it will call onDestroy() on the current Activity, If you press HOME it only calls onPause()
Don't be too worried about it though, Activities won't drain battery they are just left in memory so they can be opened faster in the future.

I wouldn't recommend using one of those task killer apps Android is designed to keep that stuff in memory for a reason, using a task killer is only one more extra service tugging away at your battery.. What you need to watch out for is apps that run services in the background like twitter or email clients pulling their servers, any good app that has a service like that will have an option to turn it off.

I have noticed a couple apps that do eat through a lot of battery in this paused state. Namely, the latest version of Google Maps and a game I've got called GalaxIR. So keep an eye out for bad offenders and be sure to close those ones properly.
– keithjgrantSep 24 '10 at 23:21

1

you are mistaken, if it is eating your batter that is a background service.
– schwizSep 24 '10 at 23:43

5

It is indeed possible to have an application that is not well developed and does not follow the Android application life cycle. For instance, a thread can be left active in an activity even after it was paused by the OS (by pressing Home), in this case the app will continue using battery.
– jmbouffardFeb 4 '11 at 12:52

1

I have found that many apps do not exit when I hit the Back button. For example:Pandora, G
– Clay NicholsDec 23 '12 at 0:32

1

(my edit time expired)....other apps that don't close on Back button: Pandora (which even continues to play after pressing Back), Google Play Store, FaceBook, Podkicker. The way I'm testing is to click the Back button until the app disappears (usually that puts me back on Home) and then running Easy Task Killer.
– Clay NicholsDec 23 '12 at 0:40

I'm pretty sure that everything I've ever read says that the Back button is the right way to exit out of apps.

Pressing Home leaves them running in the background until Android decides that they're not needed any more, which can be handy if you just need to switch between apps to check something (holding Home for a couple of seconds gives you the list of recently running apps you can switch back to on most phones) but coming out using the back button tells the app that you want it to close.

Activities don't run in the background

In Android, activities (that is, the part of the app you can see) never run in the background. They can only run (and use battery power) while they're on the screen. The activity stops running regardless of whether you use home or back to leave it. The only difference is what data Android asks the app to save, so neither option is "the right way". It just depends on what you want to do.

Home

If you use home, Android leaves the app in the same state, so that if you come back to it later (e.g. through the recent apps list), it'll still be in the same state you left it: on the same screen, with the same stuff shown. For example, if it's an email app, and you were looking at one email, then it'll remember which email that was, and show you the same one.

Eventually (after about half an hour), Android concludes that you're not coming back to the app, so it resets this state: next time you start the app, it'll start from the front/main screen. To continue the example, the email app will forget which email and folder you were looking at, and show you the inbox.

Back

If you use back, you're telling Android that you don't want to come back to this view. It'll destroy the information about what you were looking at right away. Next time you start the app, it'll show the front screen (e.g. the inbox).

As others have said, apps can control the behaviour of the back button: for example, web browsers use it to go back in the browser history. What I've described is the default behaviour of the back button, and developers are urged to keep the behaviour like that to avoid being confusing.

Cached background processes

Whichever method you use, Android will leave the app in memory (but not running) for as long as it can. This is to be more efficient. When you come back to the app, if it's still in memory, Android can run it again right away; if it isn't still in memory, then Android has to spend time and energy loading the app from storage again.

In old Android versions, apps left in memory in the background this way were included in the list of "running apps". This is a little confusing for users - it makes people think the app is really still running - so newer versions call these apps "cached background processes", to make it clear they're only cached, not running.

What about background apps?

Earlier on, I said that activities don't run in the background. So how does your email client check for mail? As well as activities, apps can have services. Services don't have any GUI for you to see or interact with, but they do run in the background. Usually, a service will only run infrequently, such as to check mail once an hour, but it's possible for the app developer to run the service all the time, draining your battery.

Leaving an activity with back or home doesn't change how Android treats any services from the same app: the service can continue to run, or be triggered later at a given time (next time the mail check is due).

Summary

In summary, it doesn't really matter whether you use back or home: it only changes what the app shows you next time you run it. It doesn't have an effect on battery use. Neither of them corresponds to "exiting" a program on your PC.

I'm so glad someone covered this! I'm a developer, but I used to work for Verizon Wireless and I can't tell you how many people were concerned about this when there wasn't any need to be.
– RoanJan 9 '14 at 20:23

In Android, applications never need to be closed and the OS is taking care of cleaning the memory of any remaining applications when the resources are needed elsewhere. Using a task killer will just break the normal operation of the OS and could even slow down the device because the applications will always have to be reloaded from the start.

Android application life cycle is working in a way that applications that are not on top are moved in a paused state that doesn't use any cpu anymore; only the memory content is kept in case the application is opened again; and the memory will be freed if needed.

This being said, the application developer has the responsibility to follow the application life cycle when he creates his application so some bugs or mistakes can happen that will result in an application that never really stops or pause. If you encounter such application and what to close it you can do it through the "Settings" -> "applications" -> "Manage applications" by selecting "Force stop" on the application.

But I would really not recommend using a task killer that is constantly running on the device.

Just want to add in schwiz's answer that it's just few lines of code needed to override the functionality of the back button. So it's not always reliable to close the app. So if the app developer doesn't want to close the app on pressing the back button, it won't get closed.

Although most good app developers popup an alert dialog on pressing back button on home menu of the app, asking if the user intends to exit the app or not, if you click on exit, it does close the app.

The correct answer could be this, the closure of the app is completely upon the app developer, if they wants the app to close on pressing the home button, they'll put the exit code in onPause(). If they want it on back button, they'll put it in the onBackKeyPressed. So it's not really in hand of the user.

The user can just avoid using the apps which doesn't provide the proper closing functionality, when not needed. The task managers are not a good way to close the app, since it can crash the app and doesn't give them a chance to save their state.

The OS does close the app whenever necessary, so you should not worry too much about it.

Edit:
There's an option to destroy the applications, as soon as you leave the app i.e. when you click the home key. You can go to Settings->Developer Options->Don't keep Activities. Although it's a developer option, but if you're too concerned about the apps running in background, you can use this option. But keep in mind that it's not recommended to be used by non-developers.

Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).