当应用运行起来后就会开启一条线程,线程中会运行一个任务栈,当Activity实例创建后就会放入任务栈中。Activity
启动模式的设置在AndroidManifest.xml文件中,通过配置Activity的属性android:launchMode=""设置,例如:
<activity android:name=".MainActivity" android:launchMode="standard" />
1. Standared模式(默认)
"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.
默认标准的启动模式, 每次startActivity都是创建一个新的activity的实例。适用于绝大大数情况
2. SingleTop模式
"singleTop"