2013-06-17

今天基本规律了些,早上去上班的路上背单词.从知春路到三元桥的时候比较无奈,

没有按照计划看点笔试题是因为还没有找好,于是随便看了下ipad上的PDF,什么java基础知识.

今天晚上回来找了个面试题七八十题的样子,比较基础的概念性的,应该够看一阵子了吧.

本来的打算是下班后在单位看看操作系统的视频,每天一集来着.但是单位了没有视频于是就早早回来了.

但是我也疑惑这样行不行阿,下班了我就累到不行.这么看是不是会没什么效果呢?

今天上班解决bug.唉,我都不好意思说,眼高手低的同时还是之前写的代码太烂,得加油了.管他呢,能变好一点是一点吧.

今天完全没看linux相关的内容这会写日记还是在windows上呢,这个得批评阿.

C语言相关的也完全没有弄,主要是回到宿舍看操作系统了.最近没什么事情,上班的时间一定要好好安排安排.

对了,下班回来的路上,我看了一路上蜡笔小新.这个...说什么好呢?

想要一双新鞋子,想要一身新衣服.

 

http://developer.android.com/guide/components/tasks-and-back-stack.html

早上读了上面这篇文档,重点看了managing tasks.没法量化到底懂了多少,只是知道比从前更明白.

Defining launch modes

Launch modes allow you to define how a new instance of an activity is associated with the current task.

You can define different launch modes in two ways:

Using the manifest file
When you declare an activity in your manifest file, you can specify how the activity should associate with tasks when it starts.
Using Intent flags
When you call startActivity(), you can include a flag in the Intent that declares how (or whether) the new activity should associate with the current task.

The launchMode attribute specifies an instruction on how the activity should be launched into a task. There are four different launch modes you can assign to the launchMode attribute:

"standard" (the default mode)
Default. The system creates a new instance of the activity in the task from which it was started and routes the intent to it. The activity can be instantiated multiple times, each instance can belong to different tasks, and one task can have multiple instances.
"singleTop"
If an instance of the activity already exists at the top of the current task, the system routes the intent to that instance through a call to its onNewIntent() method, rather than creating a new instance of the activity. The activity can be instantiated multiple times, each instance can belong to different tasks, and one task can have multiple instances (but only if the activity at the top of the back stack is not an existing instance of the activity).
For example, suppose a task's back stack consists of root activity A with activities B, C, and D on top (the stack is A-B-C-D; D is on top). An intent arrives for an activity of type D. If D has the default "standard" launch mode, a new instance of the class is launched and the stack becomes A-B-C-D-D. However, if D's launch mode is "singleTop", the existing instance of D receives the intent through onNewIntent(), because it's at the top of the stack—the stack remains A-B-C-D. However, if an intent arrives for an activity of type B, then a new instance of B is added to the stack, even if its launch mode is "singleTop".

Note: When a new instance of an activity is created, the user can press the Back button to return to the previous activity. But when an existing instance of an activity handles a new intent, the user cannot press the Back button to return to the state of the activity before the new intent arrived in onNewIntent().

"singleTask"
The system creates a new task and instantiates the activity at the root of the new task. However, if an instance of the activity already exists in a separate task, the system routes the intent to the existing instance through a call to its onNewIntent() method, rather than creating a new instance. Only one instance of the activity can exist at a time.
Note: Although the activity starts in a new task, the Back button still returns the user to the previous activity.

"singleInstance".
Same as "singleTask", except that the system doesn't launch any other activities into the task holding the instance. The activity is always the single and only member of its task; any activities started by this one open in a separate task.
As another example, the Android Browser application declares that the web browser activity should always open in its own task—by specifying the singleTask launch mode in the <activity> element. This means that if your application issues an intent to open the Android Browser, its activity is not placed in the same task as your application. Instead, either a new task starts for the Browser or, if the Browser already has a task running in the background, that task is brought forward to handle the new intent.

Regardless of whether an activity starts in a new task or in the same task as the activity that started it, the Back button always takes the user to the previous activity. However, if you start an activity that specifies the singleTask launch mode, then if an instance of that activity exists in a background task, that whole task is brought to the foreground. At this point, the back stack now includes all activities from the task brought forward, at the top of the stack. Figure 4 illustrates this type of scenario.

 

posted on 2013-06-17 23:07  lightman_21  阅读(181)  评论(0)    收藏  举报

导航