what exactly android's home button doing?

血红的双手。 提交于 2019-12-23 01:19:18

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/11377429/what-exactly-androids-home-button-doing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!