I need to finish an android application. For that i wrote
@Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(
Android is made in such a way that virtually NO application that was once opened, is closed.
Before mis-interpreting the statement, understand this.
"Whenever you exit your app, Android saves all the things the app was doing (called its state) and pushes the app in the background, calling the onStop() method. this is the new state of the application then, where the app isn't running, but isn't flushed out of the memory too. whenever you start the app again, it is resumed from the frozen state. Only when the memory, where frozen apps are kept, starts getting full, the Android GC flushes the app."
So conceptually, nothing goes out. when you hit "back" button while ur on the first activity, Android bundles the app and data, and freezes it.