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 activity is present in a task and gets to the top, no new activity is initiated
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, put activity into a new task
intent.addflags (intent.flag_activity_new_task);
//If the activity has been run to a task, jumping again will not run the activity
intent.addflags (intent.flag_activity_single_top);
About activity task management for Android