1

What I do know is that the current activity get into the onPause() mode, and the home screen activity brought to front.

My confusion starts with situation you can re-open the application from the recent tasks menu. so what exactly happening when I'm opening the application from the recent tasks manager?

Is the activity that was foreground when the home button pressed is still somewhere in the stack?

Is there more then one activity stack on the same time?

Tim
  • 35,413
  • 11
  • 95
  • 121
Tal Kanel
  • 10,475
  • 10
  • 60
  • 98
  • @Orlymee: I don't know marakana. is he an android's official documentation source? if not - then I don't understand why I can't find information about it in the android developers web site. also I don't think my question deserves down-votes. I bet a lot of developers don't know what discussed in Raykud's answer! – Tal Kanel Jul 07 '12 at 22:07

2 Answers2

3

As far as I understand it, there is no real stack (of applications). Is just that your activity has states, so whenever you are pressing the HOME button your activity in your current application just "pauses" like if it was a stand-by state so multiple applications can be in this state as long as the system doesnt require memory and kill the tasks. So whenever you open the activity from the recent tasks its just telling the application to wake up.

Raykud
  • 2,488
  • 3
  • 21
  • 41
  • There is a stack of activities in each task which you can ascend with the back button – Chris Stratton Jul 07 '12 at 18:25
  • there is a stack of activities but not of applications (afaik). I just edited to be more clear. – Raykud Jul 07 '12 at 19:28
  • @Raykud: from what you and Chris Statton saying, each one of these applications got it own stack of activities, and when I choose to wake up one of them - some context switch been done, and the application's stack "coming back to business" ? – Tal Kanel Jul 07 '12 at 21:57
  • @Chris Stratton: can you tell me where in android developers web site can I find documentation about this behavior discussed? – Tal Kanel Jul 07 '12 at 21:59
  • 2
    Almost - think more in terms of a task, which may include activities from more than one application stacked by intents to accomplish something. The recent tasks let you pick various task stacks by the activity on top of each. I'm sure it is written up somewhere, but it will become clearest if you write some activities which send or receive intents, especially external to your app. – Chris Stratton Jul 07 '12 at 22:30
  • to see the list of recent tasks you can do as http://stackoverflow.com/a/5300592/1084764 – Raykud Jul 08 '12 at 00:44
0

First of all, here is everything you need to know about the concept of the "Up Button": Navigation with Back and Up and some of the implementation details: Providing Ancestral and Temporal Navigation.

Generally speaking, the Up button lets you navigate up in the application hierarchy, instead of just navigating back in the application(s) back-stack.

For example, if you work with some kind of app and you get the email notification, you can open the mail client by pressing the notification. Then you can go back to you application you were working with by pressing the Back button ( back-stack ) or you can press the Up button in order to go to the mail client's 'parent' activity ( for example from some EmailMessageActivity to EmailHomeActivity ) to work with the mail client application instead of the initial application ( the back-stack usually is cleared then, so you can only go back with the Back button as far as the the Android Home screen ).

The "Recent Tasks" factor is irrelevant and misleading, it's just another way of starting a new Activity.

vizZ
  • 1,530
  • 14
  • 14
  • there is no connection between what I've asked to your answer. I wanted information about the home button, and you wrote me about back and up buttons. that's I know what they are doing. – Tal Kanel Jul 07 '12 at 21:52
  • If you understand the topics linked by VizZ, it's hard to see what you would still find confusing about the home button. – Chris Stratton Jul 07 '12 at 23:25
  • Actually, he's a bit right Chris. He was referring to the Android's hardware Home button, I guess. I thought, he meant the "Up" button which is sometimes called the "Home Button" ( for example, it's default id is android.R.id.home ). My bad. On the other hand if you know what Up/Back button do, how can you not know what is happening when you click the Home button? Also, why don't you check it yourself by running some sample application in the Debug mode with breakpoints on the activity's lifecycle callback methods (onCreate, onStart, onResume, onPause, onStop, onDestroy )? – vizZ Jul 08 '12 at 13:37
  • @vizZ: I checked it already. but before Raykud's answer and Chris comments - I was pretty sure that the only way activity can be paused - is by being somewhere inside the "one and only one" activities stack. now I understand that it can be also in this "parallel" sleeping apps mode, which can be destroyed by the system anytime it decides to, according to the free memory state, and from the other hand - it can be restored on top of the activities stack when user select it from the recent apps (unless if it destroyed by the system, and then create from scratch). – Tal Kanel Jul 09 '12 at 20:46