Android default launchMode of LAUNCHER activity?

后端 未结 5 964
礼貌的吻别
礼貌的吻别 2021-02-18 23:07

does the launchMode of the launcher activity in the manifest get ignored? The android documentation says that the default

5条回答
  •  走了就别回头了
    2021-02-18 23:59

    The behavior of Activity set to standard mode is a new Activity will always be created to work separately with each Intent sent. Imagine, if there are 10 Intents sent to compose an email, there should be 10 Activities launch to serve each Intent separately. As a result, there could be an unlimited number of this kind of Activity launched in a device.

    Behavior on Android pre-Lollipop

    standard Activity would be created and placed on top of stack in the same task as one that sent an Intent. For example, when we share an image from gallery to a standard Activity, It will be stacked in the same task as described although they are from the different application. If we switch the application to the another one and then switch back to Gallery, we will still see that standard launchMode place on top of Gallery's task. As a result, if we need to do anything with Gallery, we have to finish our job in that additional Activity first.

    Behavior on Android Lollipop

    If the Activities are from the same application, it will work just like on pre-Lollipop, stacked on top of the task. But in case that an Intent is sent from a different application. New task will be created and the newly created Activity will be placed as a root Activity like below.

    Source from here

提交回复
热议问题