2011年11月24日 星期四

何謂Task

To the user, it will seem as if the map viewer is part of the same application as your activity, even though it's defined in another application and runs in that application's process. Android maintains this user experience by 
keeping both activities in the same 
task. Simply put, a task is what the user experiences as an "application." It's a group of related activities, arranged in a stack.
Task是使用者在使用Application時的User Experiences。如果今天我們的功能要開啟Google gmail,也許我們程式會做連結直接開啟gmail。但這個gmail卻不是我們寫的。但從我們的程式到展開gmail卻感覺是一體的。那是因為Google想要照顧這部份的使用者經驗。
Task寫在Stack,也就是堆疊裡。

The root activity in the stack is the one that began the task — typically, it's an activity the user selected in the application launcher. 
The activity at the top of the stack is one that's currently running — the one that is the focus for user actions. When one activity starts another, the new activity is pushed on the stack; it becomes the running activity. The previous activity remains in the stack. When the user presses the BACK key, the current activity is popped from the stack, and the previous one resumes as the running activity.
Task裡放的,就是我們在使用一隻應用程式時,所有和這隻應用程式相關的Activity的存放空間。程式會依我們最先開啟的Activity,在堆疊裡,開出一個Task(任務)空間,然後呢,它被放在Task的最頂層。如果此時又開了一個新的Activity,就會把前一個Activity往下推,而成為你眼前看到的畫面。之前那個Activity還是在堆疊裡,所以如果此時你又按了[返回]鍵,目前的新畫面,會"彈出"這個堆疊,然後把之前的Activity,利用onResume()的方式,呼叫回來你面前。

A task is a stack of activities, not a class or an element in the manifest file.
Task是一個Activity的堆疊,而非類別或任何manifest檔裡你看的見的物件。

沒有留言:

張貼留言