Four startup modes of Activity

Activity's android:launchMode attribute

    standard: standard mode, default

    singleTop: Task stack top taking mode

    singleTask: Task stack multiplexing mode

    singleInstance: global singleton mode

standard

    Activity is managed by the task stack. Every time an Activity is started, it will be put into the stack. Pressing the return key will remove an Activity from the top of the stack.

    standard is the default startup mode, the standard mode. Every time an Activity is started, a new instance is created.

singleTop

   When the target Activity to be started is already on the top of the stack, a new instance will not be created, the Activity on the top of the stack will be reused, and its onNewIntent() method will be called; if the target Activity is not on the top of the stack, a new instance will be created like standard instance of

singleTask

    In the same task stack, if the target Activity to be started is already in the stack, the Activity will be reused, its onNewIntent() will be called, and the Activity above the Activity will be cleared; if it is not in the stack, a new one will be created Example

singleInstance

    Global reuse, no matter which Taskj stack, as long as there is a target Activity, it will be reused. Each Activity occupies a new Task stack

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325723002&siteId=291194637