harmony 鸿蒙Page Stack and MissionList

  • 2023-02-03
  • 浏览 (624)

Page Stack and MissionList

Page Stack

A single UIAbility component can implement multiple pages and redirection between these pages. The redirection relationship inside the UIAbility component is called page stack, which is managed by the ArkUI framework. For example, Page1 -> Page2 -> Page3 of UIAbility1 and PageA -> PageB -> PageC of UIAbility2 in the figure below are two page stacks.

Figure 1 Page stack

mission-record

  • A page stack is formed as follows (Steps 2, 3, 5, and 6 are page redirection and managed by ArkUI):

    1. Touch the icon on the home screen. The startAbility method is called to start UIAbility1, whose initial page is Page1.

    2. Touch a button on Page1. The Navigator method is called to redirect you to Page2.

    3. Touch a button on Page2. The Navigator method is called to redirect you to Page3.

    4. Touch a button on Page3. The startAbility method is called to start UIAbility2, whose initial page is PageA.

    5. Touch a button on PageA. The Navigator method is called to redirect you to PageB.

    6. Touch a button on PageB. The Navigator method is called to redirect you to PageC.

  • The page stack return is as follows (Steps 1, 2, 4, and 5 are page redirection and managed by ArkUI):

    1. Touch the Back button on PageC of UIAbility2 to return to PageB.

    2. Touch the Back button on PageB of UIAbility2 to return to PageA.

    3. Touch the Back button on PageA of UIAbility2 to return to Page3 of UIAbility1.

    4. Touch the Back button on Page3 of UIAbility1 to return to Page2.

    5. Touch the Back button on Page2 of UIAbility1 to return to Page1 of UIAbility1.

    6. Touch the Back button on Page1 of UIAbility1 to return to the home screen.

MissionList

As described above, you can keep touching the Back button on the page of Ability2 to return to a page of Ability1. The MissionList records the startup relationship between missions. If Ability1 starts Ability2 through startAbility(), a MissionList is formed: Ability1 -> Ability2. Therefore, when you touch the Back button on the initial page of Ability2, a page of Ability1 is displayed.

The mission startup relationship recorded by the MissionList may be broken in the following cases:

  • A user moves a mission in the middle of the MissionList to the foreground. mission-chain1

  • A user deletes a mission in the MissionList. mission-chain2

  • A UIAbility singleton is repeatedly started by different missions (including other abilities or the home screen). For example, AbilityB in the figure below is a singleton. mission-chain3

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Application Models

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Using Implicit Want to Open a Website

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙AccessibilityExtensionAbility

harmony 鸿蒙Common action and entities Values

harmony 鸿蒙API Switching Overview

harmony 鸿蒙Switching of app and deviceConfig

0  赞