Android task stack

Table of contents

Introduction

1.standard mode (standard mode)

2. singleTop mode (stack top multiplexing mode)

3. singleTask mode (in-stack multiplexing mode)

4. singleInstance mode (singleton mode)


Introduction

Configure the startup mode in the manifest file. There are four startup modes in total, and the stack is used for Activity management.

  1. standard

  2. singleTop

  3. singleTask

  4. singleInstance


1.standard mode (standard mode)

    The default startup mode. If you don’t specify the startup mode of the activity, use this mode to start the activity. Every time you click the standard mode, a new activity will be created to cover the original activity.


2. singleTop mode (stack top multiplexing mode)

    When the activity start mode is singleTop, then when starting, the system will judge whether the activity on the top of the stack is the activity to be started, if not, create a new activity, and if it is, use it directly.


3. singleTask mode (in-stack multiplexing mode)

    singleTask detects whether there is a currently started activity in the entire activity stack. If it exists, it will be placed on the top of the stack, and all the above activities will be destroyed; if the started activity is already in a stack in the background, then after startup, a The task stack will be switched to the foreground together.


4. singleInstance mode (singleton mode)

    Similar to the tool principle of the browser, when multiple programs access the browser, if the current browser is not opened, the browser is opened, otherwise, the currently opened browser is used for access.


 If there is any mistake, I hope all the big guys who are watching can point it out~ 

Guess you like

Origin blog.csdn.net/weixin_44715733/article/details/127519289