Mark, if the Activity D is in Manifest. xml declares that the Task affinity is added. The system first checks whether the Task stack with the same affinity as D exists. If yes, D is pushed to the stack, if it does not exist, a new D's affinity stack will be created to press it. If Task affinity of D is not set by default, it is pushed to stack 1 to a B C D, which is the same as without marking. However, if you try to start an Activity from an abnormal non-activity path, such as starting an Activity from a service or BroadcastReceiver, set intent. Flag. The Activity must exist in the Activity stack, but the stack of the Activity does not exist when the Activity is started by means of the Activity. Therefore, a new Activity stack should be created to store the Activity to be started.
Tag, the stack situation becomes: a B. If this tag is not added, the stack is changed to a B c d B. That is to say, if a tag is set and the target Activity already exists in the stack, the Activity located above the target Activity is destroyed from the stack.