Screen switching method and device, equipment and medium

By storing view model sets and creating screen switching tasks, the problem of page-level data transfer that cannot be achieved in existing technologies is solved. This enables the transfer of non-serialized data and the storage and recovery of page-level data, and supports screen switching for non-system applications.

CN120848759APending Publication Date: 2025-10-28BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410509876.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2025-10-28

Smart Images

  • Figure CN120848759A_ABST
    Figure CN120848759A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a screen switching method and device, equipment and a medium. The method comprises the steps that in response to a screen switching operation, a view model set of a target page is stored in a target storage space, and the screen switching operation triggers switching of the target page from a first screen to a second screen; storing indication information pointing to the target storage space into target information, wherein the target information comprises information associated with an activity instance of the first screen; creating a screen switching task, wherein the screen switching task comprises a task of switching the target page from the first screen to the second screen based on the target information; and deleting the activity instance of the first screen and executing the screen switching task. By determining the view model set of the target page and storing the view model set to the target storage space, a data storage method is unified, the view model set of the target page can be represented only through one piece of indication information, the definition process of data storage is simplified, and storage of page-level data before and after screen switching is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of electronic technology, and in particular to a screen switching method, apparatus, device, and medium. Background Art

[0002] Currently, three-finger drag-and-drop is commonly used to switch between screens for interaction. However, this is a system-level function that ordinary applications cannot directly call. It can only switch the entire page stack from screen A to screen B, not just the current page. Some products may have multiple screens, but they do not support three-finger drag-and-drop. If data is stored in key-value pairs, switching from screen A to screen B involves many data types, requiring the definition of a large number of keys. Furthermore, the transmitted data must be serializable. Summary of the Invention

[0003] This disclosure provides a screen switching method, apparatus, device, and medium to achieve screen switching of displayed pages.

[0004] In a first aspect, embodiments of this disclosure provide a screen switching method, including:

[0005] In response to a screen switching operation, the view model set of the target page is stored in the target storage space, and the screen switching operation triggers the switching of the target page from the first screen to the second screen;

[0006] The indication information pointing to the target storage space is stored in the target information, which includes information related to the activity instance of the first screen and the activity instance of the second screen;

[0007] Create a screen switching task, the screen switching task including a task to switch the target page from the first screen to the second screen based on the target information;

[0008] Delete the active instance on the first screen and execute the screen switching task.

[0009] Secondly, this disclosure also provides a screen switching method, including:

[0010] In the method for creating the activity instance corresponding to the second screen, the indication information pointing to the target storage space is obtained from the target information;

[0011] The view model set is obtained from the target storage space based on the indication information pointing to the target storage space;

[0012] The view model set is obtained in the time-attachment method of the segment corresponding to the second screen;

[0013] Obtain the view model from the view model set;

[0014] The target page is reconstructed based on the view model.

[0015] Thirdly, embodiments of this disclosure also provide a screen switching device, including:

[0016] An operation response module is used to respond to a screen switching operation by storing the view model set of the target page into the target storage space. The screen switching operation triggers the switching of the target page from the first screen to the second screen.

[0017] An instruction information storage module is used to store instruction information pointing to the target storage space into target information, wherein the target information includes information associated with the active instance of the first screen;

[0018] The task creation module is used to create screen switching tasks, which include tasks that switch the target page from the first screen to the second screen based on the target information;

[0019] The task deletion module is used to delete the active instance of the first screen and execute the screen switching task.

[0020] Fourthly, embodiments of this disclosure also provide a screen switching device, including:

[0021] The instruction information acquisition module is used to obtain instruction information pointing to the target storage space from the target information in the creation method of the activity instance corresponding to the second screen;

[0022] The first acquisition module is used to acquire a view model set from the target storage space based on the indication information pointing to the target storage space;

[0023] The second acquisition module is used to acquire the view model set in the time-attachment method of the segment corresponding to the second screen;

[0024] The third acquisition module is used to acquire view models from the view model set;

[0025] The page restoration module is used to restore the target page based on the view model.

[0026] Fifthly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0027] One or more processing devices;

[0028] Storage device for storing one or more programs.

[0029] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the screen switching method as described in any embodiment of the present invention.

[0030] Fifthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the screen switching method as described in any embodiment of the present invention.

[0031] In this embodiment, in response to a screen switching operation, the view model set of the target page is stored in a target storage space. The screen switching operation triggers a switch of the target page from a first screen to a second screen. Indication information pointing to the target storage space is stored in target information, which includes information about active instances associated with the first screen. A screen switching task is created, which includes a task to switch the target page from the first screen to the second screen based on the target information. The active instance of the first screen is deleted, and the screen switching task is executed. By determining and storing the view model set of the target page in the target storage space, the method of storing data is unified. The view model set of the target page can be represented by only an indication information pointing to the target storage space, simplifying the data storage definition process. This allows for the transmission of non-serialized data and enables the storage of page-level data before and after screen switching, providing support for subsequent reconstruction of the target page using page-level data. Attached Figure Description

[0032] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0033] Figure 1 This is a schematic flowchart of a screen switching method provided in an embodiment of this disclosure;

[0034] Figure 2 This is a schematic flowchart of another screen switching method provided in this embodiment of the disclosure;

[0035] Figure 3 This is an example diagram of a segment tree in a screen switching method provided in an embodiment of this disclosure;

[0036] Figure 4 This is an example diagram of the view model set of the target page in a screen switching method provided in this embodiment of the disclosure;

[0037] Figure 5 This is a schematic flowchart of a screen switching method provided in an embodiment of the present disclosure;

[0038] Figure 6 This is a schematic diagram of a screen switching device structure provided in an embodiment of the present disclosure;

[0039] Figure 7 This is a schematic diagram of another screen switching device structure provided in an embodiment of this disclosure;

[0040] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0041] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0042] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0043] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0044] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0045] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0046] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0047] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0048] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0049] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0050] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0051] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0052] Figure 1 This is a schematic diagram of a screen switching method provided in an embodiment of the present disclosure. The embodiments of the present disclosure are applicable to the situation where screen switching is performed on a first screen. The method can be executed by a screen switching device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal, a PC, a server, or an in-vehicle entertainment device.

[0053] For example, to facilitate understanding of the applicable scenarios of this invention, a specific example is used in the context of an in-vehicle entertainment system. The front passenger can watch videos on the front passenger entertainment screen. The front passenger can switch the currently playing video page (i.e., the target page below) to another screen (i.e., the second screen below), such as the rear seat entertainment screen, using gestures or buttons to trigger screen switching operations. This allows users in the back seat to watch the current video on the target screen. Simultaneously, the front passenger can also select previews of other videos on the parent page corresponding to the current video page (e.g., movie recommendations, TV series recommendations, or animation recommendations typically included in video applications).

[0054] like Figure 1 As shown, the method includes:

[0055] S110. In response to the screen switching operation, the view model set of the target page is stored in the target storage space. The screen switching operation triggers the switching of the target page from the first screen to the second screen.

[0056] In this embodiment, screen switching operation can be understood as an operation that switches the displayed content from one screen to another for display, triggered by a corresponding operation.

[0057] It's important to understand that the content displayed on a screen through software or pages may comprise multiple levels. For example, the first level might be the homepage, which lists different functions. Selecting a function displays it on a second-level page. To display more detailed content within that function, a third-level page might be needed. Therefore, a page stack is typically used to record the relationships between pages. When switching screens, for instance, if a user wants to switch a third-level page from the first screen to the second screen, current technology usually switches the entire page stack from the first screen to the second screen. This means switching all the content displayed by the software to the second screen, even though the user only wants to switch the third-level page. Correspondingly, the target page can be understood as the page on the first screen that the user wants to switch to on the second screen. The user interacts with the application through this page, which can be any level in the page stack. For example, the third-level page mentioned above can be selected by the user through dragging or clicking. The first screen can be the screen where the target page was located before the screen switch. The second screen can be the screen where the target page is located after the screen switch.

[0058] Understandably, a target page can be an Activity instance. An Activity is an Android application component that provides a visual interface for screen interaction. Each Activity receives a window to draw its user interface; the window can fill the screen or be smaller and float on top of other windows. To support the independent display of content or functionality included in a target page and its response to user actions, multiple reusable modular user interface components may be needed. For each modular user interface component (such as a Fragment), there are one or more ViewModels responsible for storing and managing data related to the interface component in a lifecycle manner, ensuring the independence of each displayed part in the target page.

[0059] In this embodiment, the view model set can be understood as a collection of view models corresponding to the modular user interface components used to support the display of the target page. Each view model can be displayed based on a hierarchical relationship, such as a tree structure. The target storage space can be understood as the storage space used to store the view model set corresponding to the target page, and can be storage space provided through temporary storage or other means. The second screen can be understood as another screen used to display the target page. For example, in a vehicle environment, the first screen can be the central control screen, and the second screen can be the passenger entertainment screen or the rear seat entertainment screen, etc.

[0060] Specifically, the first or second screen can provide interactive methods to the user through touch or buttons. The user can switch the selected target page to the selected screen by touching or clicking the corresponding button (for example, providing a screen-switching button on the screen or using three-finger swiping). This screen switching operation triggers the target page to switch from the first screen to the second screen. The processing device can respond to the screen switching operation by first determining the target page corresponding to the screen switching operation and the second screen to switch to. The processing device can establish a tree-like relationship between the components supporting the display of the target page, as well as the mapping relationship between the components and their corresponding view models. Based on the tree-like relationship and mapping relationship of the components, the processing device forms a view model set for the target page. The processing device can temporarily store the view model set in the target storage space in the form of big data.

[0061] S120. Store the indication information pointing to the target storage space into the target information, which includes the activity instance information associated with the first screen.

[0062] In this embodiment, the indication information, also known as the key, can be understood as an identifier used to identify the view model set in the target storage space. The view model set can be found from the target storage space through the indication information. Target information (such as an Intent) in Android can be understood as representing the purpose of communication between different components in an application. It's a mechanism used to pass messages and launch components; it's a runtime binding mechanism that connects two different components during program execution. Through the target information, the program can send a request to Android, and Android will select the appropriate component to respond based on the request content. It includes information such as the data that may be transmitted. An Activity instance can be understood as an Android application component. Activity instances provide a visual interface for screen interaction. Different Activity instances can display different pages, and the same page requires different Activity instances to support it on different screens.

[0063] The target information includes information about the activity instances associated with the first screen and the activity instances associated with the second screen.

[0064] Specifically, the processing device can obtain target information that records the activity instance corresponding to the target page and the activity instance of the second screen. This target information records information such as the class, class name, and launch mode launched by the activity instance of the target page. After storing the view model set of the target page into the target storage space, the processing device can establish the association between the instruction information and the view model set of the target storage space by generating instruction information. By adding methods, such as the putExtra() method, the instruction information associated with the target storage space containing the view model set is stored in the target information.

[0065] S130. Create a screen switching task. The screen switching task includes a task that switches the target page from the first screen to the second screen based on the target information.

[0066] In this embodiment, the screen switching task can be understood as a task used to create an activity instance corresponding to the target page on the second screen.

[0067] Specifically, when creating a screen switching task, the processor first creates a basic activity options object, namely an ActivityOptions object, and sets the launchDisplayId property of the ActivityOptions object to the ID of the specified second screen. Then, the processor can call the startActivity() method as the next step in the screen switching task. The startActivity() method is a method in the Activity class, and the ActivityOptions object and target information are passed to the startActivity() method to launch a new Activity based on the target information. After calling startActivity(), the processor can call the finish() method as a subsequent step to actively delete the activity instance of the first screen. These steps constitute the created screen switching task.

[0068] Understandably, during screen transitions, all view model storage (i.e., data in the View ModelStore) is deleted (i.e., destroyed). To avoid cases where deletion violates the deletion-rebuild rules, the `isChangingConfigurations()` method can be overridden: First, it checks if there are any incomplete screen transition tasks. If so, it returns true to avoid cases that violate the deletion-rebuild rules. Returning true in this case will not delete data in the View Model Store, which includes all view models. If there are no incomplete screen transition tasks, it returns and executes the `isChangingConfigurations()` method to check if there are any incomplete screen transition tasks. Data in the view model storage corresponding to the screen transition task is retained during the execution of the task.

[0069] S140. Delete the active instance of the first screen and perform the screen switching task.

[0070] Specifically, the processing device can actively call the finish() method to delete the activity instance on the first screen. When the activity instance on the first screen is deleted, the processing device will call the deletion method, namely the onDestroy() method. The onDestroy() method is the last callback method in the lifecycle of the activity instance, which is used to release the resources occupied by the activity and perform the final cleanup work to end the display of the target page on the first screen and perform the screen switching task to display the target page on the second screen.

[0071] The technical solution of this disclosure, in response to a screen switching operation, stores the view model set of the target page in a target storage space. The screen switching operation triggers a switch of the target page from a first screen to a second screen. Indication information pointing to the target storage space is stored in target information, which includes active instance information associated with the first screen. A screen switching task is created, which includes a task to switch the target page from the first screen to the second screen based on the target information. The active instance of the first screen is deleted, and the screen switching task is executed. By determining the view model set of the target page and storing it in the target storage space, the method of storing data is unified. Only one indication information pointing to the target storage space is needed to represent the view model set containing all the data of the target page, simplifying the data storage definition process. This allows for the transmission of non-serialized data and enables the storage of page-level data before and after screen switching, providing support for subsequent restoration of the target page using page-level data.

[0072] Figure 2 This is a flowchart illustrating a screen switching method provided by an embodiment of the present disclosure. Further explanations of the above embodiments are provided in this disclosure. Figure 2 As shown, the screen switching method can be specifically optimized by including the following steps:

[0073] like Figure 2 As shown, the method includes:

[0074] S210, in response to a screen switching operation, determines whether a screen switch is possible.

[0075] Specifically, the processing device can respond to screen switching operations by checking whether the target page can be switched by whether the activity start method, i.e., the isActivityStartAllowedOnDisplay() method, is allowed to be displayed. The device determines whether the screen can be switched by checking whether the second screen ID matches the target information. If they match, the screen can be switched; if they do not match, the screen cannot be switched.

[0076] Furthermore, based on the above embodiments, the step of determining whether screen switching is possible includes:

[0077] The system service determines whether the target information can be launched on the second screen.

[0078] Specifically, the processing device can obtain system services and forcibly cast them to objects of the ActivityManager type. Through the isActivityStartAllowedOnDisplay() method of the system service, which is a method of the ActivityManager class, it can detect whether the second screen ID matches the target information used to start the activity, and determine whether the target information can be started based on the matching result.

[0079] S220. If so, obtain the target information associated with the active instance on the first screen.

[0080] Specifically, if screen switching is possible, the processing device can obtain the target information associated with the first screen activity instance, and use the target information to determine the class name, launch mode, and retained original data of the activity instance.

[0081] S230. Based on the fragment tree of the activity instance of the first screen, determine the view model set of the target page. The structure of the view model set includes a tree structure, and the indication information of the nodes in the view model set is the same as the indication information of the corresponding nodes in the fragment tree.

[0082] In this embodiment, the fragment tree can be understood as a tree structure used to represent the correspondence between fragments and the relationship between the view models corresponding to the fragments. Each fragment is the reusable modular user interface component mentioned above. Each fragment corresponds to a view model responsible for storing and managing the relevant data.

[0083] Specifically, this can be achieved by switching the activity class (SwitchDisplayActivity) and the fragment class (SwitchDisplayFragment), which inherit the ViewModelTreeSaver interface. Subclasses of this interface can override the onSaveViewModelTree() method to save the view model. The processing unit determines the relationships between fragments based on the fragment tree of the activity instance on the first screen. Since fragments are nested, the relationships between the view models corresponding to each fragment are also nested. The fragment tree uses a fragment manager to manage all fragments at the next level. Each fragment at the next level may correspond to different fragments at the next level. The view model of each fragment can be used as the view model set corresponding to that fragment. The fragment manager forms a sub-mapping (mChildMap) within the view model set of the target page. Each view model set at the next level of the sub-mapping is mapped to its corresponding fragment, and the fragment's indicator information is mapped to the indicator information of the view model set corresponding to the next level of the sub-mapping. The view models corresponding to all fragments at the next level of the fragment manager are also stored in a view model store. This view model store is mapped to the view model mapping set (mViewModelMap) in the target page's view model set. The two sets share the same information. Each view model in the view model store constructs a view model mapping set according to its corresponding relationship. The data stored in the view model set can be solely the data needed to construct the target page. The view model set can be represented by a ViewModelTree. The handler can override the onSaveViewModelTree function, accepting a viewModelTree parameter. Inside the function, the ViewModel object is added to the viewModelTree by calling the putViewModel() method. The ViewModelTreeSaver interface is used to save and restore the state of the ViewModelTree. When an Activity or Fragment is deleted by the system, ViewModelTreeSaver automatically saves the state of the ViewModelTree and restores it the next time the Activity or Fragment is recreated.

[0084] Furthermore, based on the above embodiments, the steps for determining the view model set of the target page can be refined as follows:

[0085] a1. In the fragment tree of the active instance on the first screen, the view model corresponding to the fragment stores the associated view model and the fragment managed by the fragment manager.

[0086] In this embodiment, the view model storage can be understood as the storage space used to store the view models corresponding to fragments, and the nesting relationship between each view model and its corresponding fragment is the same. The fragment manager can be understood as a class that supports complex multi-level fragment nesting, mainly used to manage operations such as adding, replacing, hiding, showing, removing, and rewinding fragments.

[0087] Specifically, the first level of the fragment tree of the active instance on the first screen includes two branches: the fragment manager and the view model set storage. The fragments managed by the fragment manager constitute the lower branches of the fragment manager, and so on. All view model sets associated with the view model set storage constitute the lower branches of the view model set storage, and so on. The processing device can determine the view model associated with the view model storage and the fragment managed by the fragment manager according to the hierarchical relationship and branch situation.

[0088] For example, to illustrate the structure of the fragment tree in this embodiment, a specific example is provided. Figure 3 This is an example diagram of a segment tree in a screen switching method provided in an embodiment of this disclosure. Figure 3 As shown, the first level of the fragment tree is the fragment activity / fragment corresponding to the target page. The next level includes the fragment manager and the view model storage. The next level of the fragment manager includes fragment 1 to fragment N, and the next level of the view model storage includes view model 1 to view model N corresponding to the fragment activity / fragment in the first level of the fragment tree.

[0089] b1. Based on the associated view models and managed fragments, form the view model set of the target page.

[0090] Specifically, the processing device can treat the view model corresponding to the managed segment as a view model set, construct a sub-mapping in the view model set of the target page through the view model set of the segment, establish mapping indication information for the view model set corresponding to each segment pointing to the sub-mapping, and construct a view model mapping set in the view model set of the target page through the view models stored in the view model storage.

[0091] For example, to facilitate understanding of the view model set corresponding to the target page, a specific example will be shown. Figure 4 This is an example diagram of the view model set of the target page in a screen switching method provided in an embodiment of this disclosure. For example... Figure 4 As shown, the first layer of the view model set includes sub-mappings and the view model mapping set. It can be seen that the sub-mappings are related to... Figure 3 The view model mapping set is mapped to the fragment manager in the context of the fragment manager. Figure 3 The view model in the memory stores a mapping, and the next level of the sub-mapping includes the mappings to the view model. Figure 3 The view model set 1-view model set N corresponding to fragment 1-fragment N, the next level of the view model mapping set includes those... Figure 3 The middle view model stores the corresponding view model 1 to view model N.

[0092] S240. Save the view model set to the target storage space through the view model tree saving interface.

[0093] In this embodiment, the view model tree saving interface can be understood as an interface used to save and restore the state of the view model set.

[0094] Specifically, the processing device can use `SwitchDisplayActivity` and `SwitchDisplayFragment`, which inherit the view model tree saving interface. Their subclasses can override the `onSaveViewModelTree()` method to save the view model set. The saved view model set only stores the correspondence between each node, while the data corresponding to each node is stored in the target storage space. Because the data in the ViewModel is not serializable, the processing device can use `MemoryBundle` to temporarily store the view model set in the target storage space. The processing device can use the `put()` method, which is a method of the `MemoryBundle` class, to add the view model set object to the target storage space.

[0095] S250. Store the indication information pointing to the target storage space into the target information, which includes the activity instance information associated with the first screen.

[0096] S260. Create a screen switching task. The screen switching task includes a task that switches the target page from the first screen to the second screen based on the target information.

[0097] S270, Delete the active instance of the first screen and perform the screen switching task.

[0098] The technical solution of this disclosure, when determining that the second screen can be switched, acquires the target information associated with the active instance of the first screen, providing a basis for creating new active instances on the second screen. Through the fragment tree of the active instances of the first screen, a view model set of the target page tree structure is constructed. The view model set establishes associations with each node in the fragment tree, and the indication information of the corresponding nodes at both ends is identical, ensuring consistency of indication information before and after screen switching. The tree-structured view model set reflects the nested structure of fragments, solving the fragment nesting problem. The view model set is saved to the target storage space through the view model tree saving interface, solving the problem of being unable to transmit non-serializable data. Indication information pointing to the target storage space is stored in the target information, realizing that only one indication information is needed to represent the data of all target pages. Furthermore, the data in the view model storage corresponding to the screen switching task is retained during the operation, avoiding data deletion due to non-compliance with deletion and reconstruction rules. This achieves the storage of page-level data before and after screen switching.

[0099] Figure 6 This is a schematic flowchart of a screen switching method provided in an embodiment of the present disclosure. The embodiments of the present disclosure are applicable to the situation where the second screen restores the page of the first screen. The method can be executed by a screen switching device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal, a PC, or a server.

[0100] like Figure 6 As shown, the method includes:

[0101] S610. In the method for creating the activity instance corresponding to the second screen, obtain the indication information pointing to the target storage space from the target information.

[0102] In this embodiment, the creation method can be understood as a method of reconstructing the activity instance corresponding to the target page.

[0103] Specifically, the method for creating the corresponding active instance on the second screen by the processing device, namely... Figure 3 The onCreate() method in the SwitchDisplayActivity class first obtains the indication information pointing to the target storage space from the target information. For example, it obtains additional string data named KEY_VIEW_MODEL_TREE (which represents the indication information pointing to the target storage space) from the passed target information and converts it into an object of type ViewModelTree. This indication information is used to point to the set of view models in the target storage space.

[0104] Among them, the factory methods for obtaining the default view model provider corresponding to the activity instance and the fragment corresponding to the second screen respectively have the function of restoring the view model from the view model set.

[0105] Specifically, since the target storage space stores the view model set corresponding to the target page, restoring the view model may call the view models recorded in the view model set. Therefore, the original default view model provider factory method needs to be rewritten. The processing device can be based on the class corresponding to the activity instance of the second screen, i.e., the class name is SwitchDisplayActivity, and the class corresponding to the fragment of the second screen, i.e., the class name is...

[0106] The `SwitchDisplayFragment` class overrides the `getDefaultViewModelProviderFactory()` method to retrieve the default view model provider factory. This provides the ability to recreate view models from a view model collection. The overridden part can be as follows: First, define a private variable `mViewModelFactory` (the child view model factory), which is an object that implements the `ViewModelProvider.Factory` interface. Based on the methods required by the `ViewModelProvider.Factory` interface, create a `ViewModel` object of the specified type; then attempt to remove the `ViewModel` associated with the given model class name from `mViewModelTree`. If found and successfully removed, return the `ViewModel` and cast it to the specified type `T`.

[0107] The technical solution of this disclosure embodiment can achieve screen switching by inheriting SwitchDisplayActivity and SwitchDisplayFragment and calling the SwitchDisplay() method of SwitchDisplayActivity. No system permissions are required, and screen switching of non-system level application pages is realized. After screen switching, not only can page data be restored, but the advantages of the Model-View-ViewModel (MVVM) development mode are also retained.

[0108] S620. Obtain the view model set from the target storage space based on the indication information pointing to the target storage space.

[0109] Specifically, the processing device can find the view model set corresponding to the indication information in the target storage space based on the indication information pointing to the target storage space.

[0110] S630, Obtain the view model set in the attachment time method corresponding to the segment of the second screen.

[0111] In this embodiment, the onAttach() method can be understood as a callback method in the fragment's lifecycle, and the fragment can interact with the activity associated with this method.

[0112] Specifically, the processing device can associate the attach time method with the view model set class to obtain the view model set.

[0113] The step of obtaining the view model set in the method of attaching the segment corresponding to the second screen can be further refined as follows:

[0114] In the method for attaching the segment corresponding to the second screen, the view model set is obtained from the activity instance corresponding to the second screen through the view model tree retrieval interface.

[0115] In this embodiment, the view model tree acquisition interface can be understood as an interface used to provide the ability to acquire the view model tree.

[0116] Specifically, in the append method of the segment corresponding to the second screen, the view model set can be obtained from the activity instance (SwitchDisplayActivity) corresponding to the second screen through the view model tree getter interface (i.e., the ViewModelTreeGetter interface). For example, the getViewModelTree method is called and the current object is passed in to get the ViewModelTree and assign it to the mViewModelTree variable.

[0117] S640. Obtain the view model from the view model set.

[0118] The timing for retrieving a view model from the view model set includes when the view model storage is empty.

[0119] Specifically, the processing device can first obtain the required view model from the view model storage. If it cannot obtain the view model, it can obtain the view model from the view model collection. If it still cannot obtain the view model from the view model collection, it can create a view model and store it in the view model storage.

[0120] The method for obtaining view models from the view model set can be further refined as follows:

[0121] Retrieve view models from the view model collection using view model provider methods.

[0122] In this embodiment, the view model provider method (i.e., the ViewModelProvider() method) can be understood as a method used to create a view model.

[0123] Specifically, the processing device can first create a ViewModelProvider instance, call the get method, i.e., the get() method, to retrieve the required view model from the view model store. If it cannot be retrieved, it will retrieve the view model from the view model collection.

[0124] S650, Restore the target page based on the view model.

[0125] Specifically, the processing device can store all view models in the view model storage, pass the processed data of the view models to the view for display, and thus restore the target page.

[0126] The technical solution of this disclosure embodiment obtains indication information pointing to the target storage space from the target information in the method for creating the activity instance corresponding to the second screen; obtains a view model set from the target storage space based on the indication information pointing to the target storage space; obtains the view model set in the time-attachment method of the segment corresponding to the second screen; obtains the view model from the view model set; and restores the target page based on the view model. By obtaining the view model set through the indication information pointing to the target storage space in the target information and calling the time-attachment method of the segment to obtain the view model, the restoration of the target page in the second screen is realized without system permissions, realizing screen switching of non-system level application pages. After screen switching, not only can page data be restored, but the advantages of the MVVM development model are also retained.

[0127] As a first optional embodiment of this example, based on the above embodiment, it further includes:

[0128] a2. During the deletion of the active instance on the second screen, delete the view model set.

[0129] Specifically, during the deletion of active instances on the second screen, such as when switching from the second screen to another screen, the process corresponds to deleting active instances on the second screen. At this time, the view model set is deleted to avoid memory leaks.

[0130] b2. In the fragment separation method of the second screen, remove the view model set.

[0131] Specifically, when executing the method to separate fragments of the second screen (SwitchDisplayFragment onDetach() method), the child view model set is removed from the parent view model set based on the parent-child view model set relationship in the view model set. This can prevent new fragment instances from reusing data and avoid memory leaks by deleting data in a timely manner.

[0132] By setting up the first optional embodiment of this example, the deletion of the view model set can be triggered at different times, which can prevent new fragment instances from reusing data and avoid memory leaks by deleting data in a timely manner.

[0133] Figure 7 This is a schematic diagram of a screen switching device structure provided in an embodiment of the present disclosure, as shown below. Figure 7 As shown, the device includes: an operation response module 710, an instruction information storage module 720, a task creation module 730, and a task deletion module 740.

[0134] The operation response module 710 is used to respond to a screen switching operation by storing the view model set of the target page into the target storage space, wherein the screen switching operation triggers the switching of the target page from the first screen to the second screen;

[0135] The instruction information storage module 720 is used to store instruction information pointing to the target storage space into target information, wherein the target information includes information associated with the active instance of the first screen;

[0136] The task creation module 730 is used to create a screen switching task, the screen switching task including a task to switch the target page from the first screen to the second screen based on the target information;

[0137] The task deletion module 740 is used to delete the active instance of the first screen and execute the screen switching task.

[0138] The technical solution of this disclosure, in response to a screen switching operation, stores the view model set of the target page in a target storage space. The screen switching operation triggers a switch of the target page from a first screen to a second screen. Indication information pointing to the target storage space is stored in target information, which includes active instance information associated with the first screen. A screen switching task is created, which includes a task to switch the target page from the first screen to the second screen based on the target information. The active instance of the first screen is deleted, and the screen switching task is executed. By determining the view model set of the target page and storing it in the target storage space, the method of storing data is unified. Only one indication information pointing to the target storage space is needed to represent the view model set containing all the data of the target page, simplifying the data storage definition process and realizing the storage of page-level data before and after screen switching.

[0139] Furthermore, the operation response module 710 includes:

[0140] The screen switching determination unit is used to determine whether a screen can be switched in response to a screen switching operation;

[0141] The information acquisition unit is used to acquire, if yes, target information associated with the active instance of the first screen;

[0142] The model set determination unit is used to determine the view model set of the target page based on the fragment tree of the active instance of the first screen. The structure of the view model set includes a tree structure, and the indication information of the nodes in the view model set is the same as the indication information of the corresponding nodes in the fragment tree.

[0143] The model set storage unit is used to save the view model set to the target storage space through the view model tree saving interface.

[0144] Specifically, the screen-switching determination unit is used for:

[0145] The system service determines whether the target information can be launched on the second screen.

[0146] Specifically, the view model set determination unit is used for:

[0147] In the fragment tree of the active instance of the first screen, the view model associated with the fragment and the fragment managed by the fragment manager are stored in the view model corresponding to the fragment;

[0148] Based on the associated view models and managed fragments, a view model set for the target page is formed.

[0149] Furthermore, the data in the view model storage corresponding to the screen switching task is retained during the operation of the task.

[0150] The screen switching device provided in this disclosure can execute the screen switching method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0151] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0152] Figure 7 This is a schematic diagram of a screen switching device structure provided in an embodiment of the present disclosure, as shown below. Figure 7 As shown, the device includes: an instruction information acquisition module 810, a first acquisition module 820, a second acquisition module 830, a third acquisition module 840, and a page restoration module 850.

[0153] The instruction information acquisition module 810 is used to acquire instruction information pointing to the target storage space from the target information in the creation method of the activity instance corresponding to the second screen.

[0154] The first acquisition module 820 is used to acquire a view model set from the target storage space based on the indication information pointing to the target storage space;

[0155] The second acquisition module 830 is used to acquire the view model set in the time-attachment method of the segment corresponding to the second screen;

[0156] The third acquisition module 840 is used to acquire view models from the view model set;

[0157] The page restoration module 850 is used to restore the target page based on the view model.

[0158] The technical solution provided in this disclosure, through the creation method of the activity instance corresponding to the second screen, obtains indication information pointing to the target storage space from the target information; obtains a view model set from the target storage space based on the indication information pointing to the target storage space; obtains the view model set in the time-attachment method of the segment corresponding to the second screen; obtains the view model from the view model set; and restores the target page based on the view model. By obtaining the view model set through the indication information pointing to the target storage space in the target information and calling the time-attachment method of the segment to obtain the view model, the restoration of the target page in the second screen is realized without system permissions, realizing screen switching of non-system level application pages. After screen switching, not only can page data be restored, but the advantages of the MVVM development model are also retained.

[0159] Furthermore, the second acquisition module 830 is specifically used for:

[0160] In the method for attaching the segment corresponding to the second screen, the view model set is obtained from the activity instance corresponding to the second screen through the view model tree acquisition interface.

[0161] Furthermore, the default view model provider factory methods corresponding to the activity instance and the fragment corresponding to the second screen respectively have the function of restoring the view model from the view model set.

[0162] Furthermore, the third acquisition module 840 is specifically used for:

[0163] View models are obtained from the view model set using the view model provider method.

[0164] The timing for obtaining a view model from the view model set includes when the view model storage is empty.

[0165] Optionally, the device further includes:

[0166] The model set deletion module is used to delete the view model set during the deletion of the active instance on the second screen;

[0167] The model set removal module is used to remove the view model set in the fragment separation method of the second screen.

[0168] The screen switching device provided in this disclosure can execute the screen switching method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0169] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0170] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 8 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 8 A structural diagram of the terminal device or server in the 900.

[0171] One or more processing devices;

[0172] Storage device for storing one or more programs.

[0173] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the screen switching method as described in any one of claims 1-5 or the screen switching method as described in any one of claims 6-11.

[0174] The terminal devices in this disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0175] like Figure 8As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An edit / output (I / O) interface 905 is also connected to the bus 904.

[0176] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0177] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.

[0178] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0179] The electronic device provided in this embodiment and the screen switching method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0180] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the screen switching method provided in the above embodiments.

[0181] It should be noted that the computer-readable medium described above in this disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination thereof.

[0182] The computer storage medium may be a storage medium for computer-executable instructions, which, when executed by a computer processor, are used to perform the methods provided in this disclosure.

[0183] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0184] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0185] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0186] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:

[0187] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: in response to a screen switching operation, store the view model set of the target page in a target storage space, the screen switching operation triggering a switch of the target page from a first screen to a second screen; store indication information pointing to the target storage space in target information, the target information including active instance information associated with the first screen; create a screen switching task, the screen switching task including a task to switch the target page from the first screen to the second screen based on the target information; delete the active instance of the first screen and execute the screen switching task.

[0188] Alternatively, the aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: in the method for creating an active instance corresponding to the second screen, obtain indication information pointing to a target storage space from the target information; obtain a view model set from the target storage space based on the indication information pointing to the target storage space; obtain the view model set in the method for attaching a segment corresponding to the second screen; obtain a view model from the view model set; and restore the target page based on the view model.

[0189] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0190] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0191] The modules or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules or units do not necessarily limit the specific unit itself.

[0192] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0193] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0194] According to one or more embodiments of this disclosure, [Example 1] provides a screen switching method, including, in response to a screen switching operation, storing a view model set of a target page in a target storage space, the screen switching operation triggering a switch of the target page from a first screen to a second screen; storing indication information pointing to the target storage space in target information, the target information including information associated with an active instance of the first screen; creating a screen switching task, the screen switching task including a task to switch the target page from the first screen to the second screen based on the target information; deleting the active instance of the first screen and executing the screen switching task.

[0195] According to one or more embodiments of this disclosure, [Example 2] provides a method of Example 1, which, in response to a screen switching operation, stores a view model set of a target page in a target storage space, including: in response to a screen switching operation, determining whether a screen can be switched; if so, obtaining target information associated with an active instance of the first screen; determining a view model set of the target page based on a fragment tree of an active instance of the first screen, wherein the structure of the view model set includes a tree structure, and the indication information of the nodes in the view model set is the same as the indication information of the corresponding nodes in the fragment tree; and saving the view model set to the target storage space through a view model tree saving interface.

[0196] According to one or more embodiments of this disclosure, [Example 3] provides a method of Example 2 to determine whether a screen can be switched, including: determining whether target information can be launched on the second screen through a system service.

[0197] According to one or more embodiments of this disclosure, [Example 4] provides a method of Example 2, which determines the view model set of the target page based on the fragment tree of the active instance of the first screen, including:

[0198] In the fragment tree of the active instance of the first screen, the view model corresponding to the fragment stores the associated view model and the fragment managed by the fragment manager; based on the associated view model and the managed fragment, the view model set of the target page is formed.

[0199] According to one or more embodiments of this disclosure, Example 5 provides the method of Example 1, in which data in the view model storage corresponding to the screen switching task is retained during the operation of the screen switching task.

[0200] According to one or more embodiments of this disclosure, [Example 6] provides a screen switching method, in which the method for creating an activity instance corresponding to a second screen is used to obtain indication information pointing to a target storage space from target information; a view model set is obtained from the target storage space based on the indication information pointing to the target storage space; the view model set is obtained in the method for attaching time to the segment corresponding to the second screen; a view model is obtained from the view model set; and the target page is restored based on the view model.

[0201] According to one or more embodiments of this disclosure, [Example 7] provides a method of Example 6, which obtains the view model set in the time-attachment method of the segment corresponding to the second screen, including: in the time-attachment method of the segment corresponding to the second screen, obtaining the view model set from the activity instance corresponding to the second screen through a view model tree acquisition interface.

[0202] According to one or more embodiments of this disclosure, [Example 8] provides the method of Example 6, wherein the default view model provider factory method corresponding to the activity instance corresponding to the second screen and the fragment corresponding to the second screen respectively has the function of restoring the view model from the view model set.

[0203] According to one or more embodiments of this disclosure, [Example 9] provides a method of Example 6 for obtaining a view model from the view model set, including: obtaining a view model from the view model set via a view model provider method.

[0204] According to one or more embodiments of this disclosure, Example 10 provides the method of Example 9, wherein the timing of obtaining a view model from the view model set includes when the view model storage is empty.

[0205] According to one or more embodiments of this disclosure, Example 11 provides the method of Example 6, which further includes: deleting the view model set during the deletion of an active instance of the second screen; and removing the view model set in a fragment separation method of the second screen.

[0206] According to one or more embodiments of this disclosure, [Example 12] provides a screen switching device, comprising: an operation response module, configured to, in response to a screen switching operation, store a view model set of a target page in a target storage space, wherein the screen switching operation triggers a switch of the target page from a first screen to a second screen; an indication information storage module, configured to store indication information pointing to the target storage space in target information, wherein the target information includes information associated with an active instance of the first screen; a task creation module, configured to create a screen switching task, wherein the screen switching task includes a task to switch the target page from the first screen to the second screen based on the target information; and a task deletion module, configured to delete the active instance of the first screen and execute the screen switching task.

[0207] According to one or more embodiments of this disclosure, [Example 13] provides a screen switching device, including: an indication information acquisition module, configured to acquire indication information pointing to a target storage space from target information in a method for creating an activity instance corresponding to a second screen; a first acquisition module, configured to acquire a view model set from the target storage space based on the indication information pointing to the target storage space; a second acquisition module, configured to acquire the view model set in a method for attaching time to a segment corresponding to the second screen; a third acquisition module, configured to acquire a view model from the view model set; and a page restoration module, configured to restore a target page based on the view model.

[0208] According to one or more embodiments of this disclosure, [Example 14] provides an electronic device, the electronic device including: one or more processing means; and a storage means for storing one or more programs, which, when executed by the one or more processing means, cause the one or more processing means to implement the screen switching method as described in any one of the embodiments of the present invention.

[0209] According to one or more embodiments of this disclosure, [Example 15] provides a storage medium for computer-executable instructions, which, when executed by a computer processor, are used to perform a screen switching method as described in any one of the embodiments of the present invention.

[0210] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0211] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0212] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A screen switching method, characterized in that, include: In response to a screen switching operation, the view model set of the target page is stored in the target storage space, and the screen switching operation triggers the switching of the target page from the first screen to the second screen; The indication information pointing to the target storage space is stored in the target information, which includes information about the active instance associated with the first screen; Create a screen switching task, the screen switching task including a task to switch the target page from the first screen to the second screen based on the target information; Delete the active instance on the first screen and execute the screen switching task.

2. The method according to claim 1, characterized in that, The step of storing the view model set of the target page into the target storage space in response to a screen switching operation includes: In response to a screen switching operation, determine whether the screen can be switched; If so, obtain the target information associated with the active instance on the first screen; Based on the fragment tree of the activity instance of the first screen, the view model set of the target page is determined. The structure of the view model set includes a tree structure, and the indication information of the nodes in the view model set is the same as the indication information of the corresponding nodes in the fragment tree. The view model set is saved to the target storage space through the view model tree saving interface.

3. The method according to claim 2, characterized in that, The determination of whether screen switching is possible includes: The system service determines whether the target information can be launched on the second screen.

4. The method according to claim 2, characterized in that, Determining the view model set of the target page based on the fragment tree of the activity instance of the first screen includes: In the fragment tree of the active instance of the first screen, the view model associated with the fragment and the fragment managed by the fragment manager are stored in the view model corresponding to the fragment; Based on the associated view models and managed fragments, a view model set for the target page is formed.

5. The method according to claim 1, characterized in that, The data in the corresponding view model storage is retained during the execution of the screen switching task.

6. A screen switching method, characterized in that, include: In the method for creating the activity instance corresponding to the second screen, the indication information pointing to the target storage space is obtained from the target information; The view model set is obtained from the target storage space based on the indication information pointing to the target storage space; The view model set is obtained in the time-attachment method of the segment corresponding to the second screen; Obtain the view model from the view model set; The target page is reconstructed based on the view model.

7. The method according to claim 6, characterized in that, The method for obtaining the view model set in the time-attachment method corresponding to the segment of the second screen includes: In the method for attaching the segment corresponding to the second screen, the view model set is obtained from the activity instance corresponding to the second screen through the view model tree acquisition interface.

8. The method according to claim 6, characterized in that, The factory methods for obtaining the default view model provider corresponding to the activity instance and the fragment corresponding to the second screen respectively have the function of restoring the view model from the view model set.

9. The method according to claim 6, characterized in that, The step of obtaining the view model from the view model set includes: View models are obtained from the view model set using the view model provider method.

10. The method according to claim 9, characterized in that, The timing for retrieving a view model from the view model set includes when the view model storage is empty.

11. The method according to claim 6, characterized in that, Also includes: During the deletion of the active instance on the second screen, the view model set is deleted; In the method for separating fragments of the second screen, the view model set is removed.

12. A screen switching device, characterized in that, include: An operation response module is used to respond to a screen switching operation by storing the view model set of the target page into the target storage space. The screen switching operation triggers the switching of the target page from the first screen to the second screen. An instruction information storage module is used to store instruction information pointing to the target storage space into target information, wherein the target information includes information associated with the active instance of the first screen; The task creation module is used to create screen switching tasks, which include tasks that switch the target page from the first screen to the second screen based on the target information; The task deletion module is used to delete the active instance of the first screen and execute the screen switching task.

13. A screen switching device, characterized in that, include: The instruction information acquisition module is used to obtain instruction information pointing to the target storage space from the target information in the creation method of the activity instance corresponding to the second screen; The first acquisition module is used to acquire a view model set from the target storage space based on the indication information pointing to the target storage space; The second acquisition module is used to acquire the view model set in the time-attachment method of the segment corresponding to the second screen; The third acquisition module is used to acquire view models from the view model set; The page restoration module is used to restore the target page based on the view model.

14. An electronic device, characterized in that, The electronic device includes: One or more processing devices; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the screen switching method as described in any one of claims 1-5 or the screen switching method as described in any one of claims 6-11.

15. A storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to perform the screen switching method as described in any one of claims 1-5 or the screen switching method as described in any one of claims 6-11.