I am trying to Understand what is a back stack concept in Android
What i have tried to learn: I went through the Developer site
My question::
activity1
- - activity2
- -activity3
.... then activity3
is at top of the back stack so if i press back
button .... I go from activity3
- - to - - activity2
...... then
again i go from activity2
- - activity1
finally[EDIT]
You can read this detailed Documentation (Developer Site) and this Presentation
Along with that there are many other things that you can do with Back Stack
, for example:
I hope this helps.
EDIT:
Activity Life Cycle and Back Stack
are 2 different entities.
When Activity's finish()
is called, the Activity is Stopped()
and removed from the Back Stack
.
The Back Stack
is updated in conjunction with the Activity's Life Cycle.
Like when a new Activity
is started, the Back Stack
is updated and the current Activity
is stacked at the Top and when an Activity
is finished, the Back Stack
is updated again and the former Activity is removed from it.