Reprinted from: http://www.cnblogs.com/mybkn/archive/2012/05/26/2519644.html
The relationship between activity and task (stack)
A task is like a container, and activity is quite the thing that fills the container, the first thing (activity) is at the bottom, and the last thing added (activity) is at the lowest end. The activity is taken from the top of the task, that is, the first thing to be taken out is the last addition (activity), one analogy, and finally the activity that was added for the first time, and the order of activity in the task can be controlled, The intent Flag is used when the activity jumps.
Second, the interface jump and service start will be used to intent, now introduce intent flag is about the activity of the jump
Intent Intent = new Intent (this,xxx.class);
If the activity is present in the task and gets to the top, no new activity is started
Intent.addflags (Intent.flag_activity_brought_to_front);
If activity is present in a task, all activity above activity is ended
Intent.addflags (Intent.flag_activity_clear_top);
Default jump type, putting activity into a new task
Intent.addflags (Intent.flag_activity_new_task);
If the activity is already running to a task, jumping again will not run the activity
Intent.addflags (Intent.flag_activity_single_top);
Android:intent Flags