ᑕଧާ֜ᝒԅᵙᑕଧާ ӥ
ᳯғ୮ڹଫአํӷӻActivity AB҅Bጱ android:launchMode ᦡᗝԧsingleTaskཛྷୗ҅Aฎἕᦊጱ
standard҅ᮎԍA startActivityސۖB҅BտෛސӞӻTaskހҘইຎӧտ҅ᮎԍstartActivityጱIntentےӤ
FLAG_ACTIVITY_NEW_TASKᬯӻ݇හտӧտޫҘ
ᒼғᦡᗝԧsingleTaskސۖཛྷୗጱActivity҅ࣁސۖጱտضࣁᔮᕹӾັં꧊affinityᒵԭጱં꧊
taskAffinityጱձۓฎވࣁইຎࣁᬯጱձۓ҅տࣁᬯӻձۓӾސۖ҅ވڞտࣁෛձۓ
Ӿސۖ
୮Intent۱ތFLAG_ACTIVITY_NEW_TASKຽᦕ҅ᔮᕹࣁັತՖᆐೲActivityጱtaskAffinityંᬰ
ᤈ܃ᯈ҅ইຎತکӞӻձۓጱtaskAffinityӨԏፘݶ҅ፓຽActivityܴفྌձۓӾ҅ইຎತӧکڞ
ڠୌӞӻෛጱձۓ
ᦡᗝԧsingleTaskސۖཛྷୗጱActivityࣁ૪ํጱձۓӾ૪ᕪࣁፘଫጱActivityֺ҅ٚސۖտᬯӻ
ActivityֺӤᶎጱActivityق᮱ᕮധԞฎ᧔singleTaskᛔଃclear topጱපຎ
TaskStackBuilder
ই֜ሿ᭗Ꭳໄ᪡کᧇఘኴᶎԏݸᅩڋᬬࢧᚆᬰفکଫአԆኴᶎᘒӧฎᔮᕹԆኴᶎҘ
http://blog.csdn.net/alone_slfly/article/details/41744323
Activityձۓ
TaskAffinity݇හ҅ձۓፘى҅ຽᦩӞӻActivityಅᵱጱձۓጱݷἕᦊఘ٭ӥ҅ಅํጱActivityಅᵱ
ጱձۓጱݷฎଫአጱ۱ݷ҅୮ᆐԞݢզܔᇿTaskAffinityં
ձۓړԅڹݣձۓݸݣձۓ҅ݸݣձۓӾጱActivity֖ԭฮ؊ᇫா(onStop)҅አಁݢզ᭗ᬦڔഘ
ݸݣձۓེٚ᧣کڹݣTaskAffinityંԆᥝsingleTaskސۖཛྷୗallowTaskRepeatingંᯈ
ֵአ҅ࣁٌ՜ఘ٭ӥֵአဌํԎ
୮TaskAffinitysingleTaskސۖཛྷୗᯈֵአጱײ҅ฎٍํᧆཛྷୗጱActivityጱፓڹձۓጱݷ҅இ
ސۖጱActivityտᬩᤈࣁݷTaskAffinityፘݶጱձۓӾҔ
୮TaskAffinityallowTaskReparentingᕮݳጱײ҅୮ӞӻଫአAސۖԧଫአBጱӻActivity Cݸ҅ইຎ
Activity CጱallowTaskReparentingંᦡᗝԅtrueጱᦾ҅ᮎԍ୮ଫአBᤩސۖݸ҅ᔮᕹտݎሿActivity Cಅ
ᵱጱձۓࣁԧ҅Activity CAጱձۓӾᑏکBጱձۓӾ
ັձۓఘ٭ጱොဩฎಗᤈ adb shell dumpsys activity
Activityጱຽᦕ֖
Activityጱຽᦕ֖
ํ FLAG_ACTIVITY_NEW_TASK , FLAG_ACTIVITY_SINGLE_TOP , FLAG_ACTIVITY_CLEAR_TOP ᒵᒵ
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS ғٍํᬯӻຽᦕጱActivityӧտڊሿࣁܲݥActivityڜᤒӾ҅୮
Զఘ٭ӥ౯ժӧ๕አಁ᭗ᬦܲݥڜᤒࢧک౯ժጱActivityጱײᬯӻຽᦕྲํአ҅ᒵݶԭંᦡ