When going back to activity A (main activity) the activity B is being destroyed. Why is that happening?
The example program I'm trying to understand is here: http://developer.android.com/shareables/training/ActivityLifecycle.zip
Here's a representation of how each new activity in a task adds an item to the back stack. When the user presses the Back button, the current activity is destroyed and the previous activity resumes.
Why destroyed? Because the latest activity is on top of the stack and to get to the next activity, you pop the latest off (LIFO). More info here.