Method and apparatus for acquiring view path, and medium and electronic device
By managing view paths in Android applications through annotation processors, the problem of developers being easily missed or miswrite codes in page jump operations is solved, and the automated management of view paths and application stability is achieved.
Patent Information
- Application Number
- PCT/CN2024/125119
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-26
- Filing Date
- 2024-10-16
- Publication Date
- 2025-07-31
AI Technical Summary
In Android application development, frequent operations such as page jumps cause developers to easily miss or write related codes incorrectly, resulting in application problems.
By annotating the processor, configure the path configuration information of the target view applied to the target active window or target fragment in the target application, and listen to its lifecycle state, automatically obtain and manage the view path, avoid manual input and maintenance.
It realizes automated management of target view paths, avoids the problems of missing or wrong code writing, and improves the stability and reliability of the application.
Smart Images

Figure CN2024125119_31072025_PF_FP_ABST
Abstract
Description
Method, device, medium and electronic device for obtaining view path Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, medium, and electronic device for obtaining a view path. Background Art
[0002] In Android application development, developers need to manually write relevant codes to implement operations such as page jump and data transfer.
[0003] However, in actual development, due to frequent operations such as page jumps, developers often omit or write incorrect codes, resulting in application problems.
[0004] Therefore, the present application provides a method for obtaining a view path to solve the above technical problems.
[0005] Summary of the Invention
[0006] The purpose of this application is to provide a method, device, medium, and electronic device for obtaining a view path, which can solve at least one of the technical problems mentioned above. The specific solution is as follows:
[0007] According to a specific embodiment of the present application, in a first aspect, the present application provides a method for obtaining a view path, comprising:
[0008] Configure the path configuration information of the target view applied by the target active window or target fragment in the target application through the annotation processor;
[0009] During the running of the target application, monitoring whether the target active window or the target fragment enters a visible state during its life cycle;
[0010] When the target active window or the target fragment enters a visible state during its life cycle, the path configuration information of the target view applied by the target active window or the target fragment is obtained, and a global path representing the target view path is obtained based on the path configuration information and the preset root path information.
[0011] Optionally, when the target active window or the target fragment enters a visible state during its life cycle, obtaining path configuration information of a target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information, includes:
[0012] When the target active window or the target fragment enters a visible state during its life cycle, in the refresh event of the target view, the path configuration information of the target view applied by the target active window or the target fragment is obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information.
[0013] Optionally, during the running of the target application, the process further includes:
[0014] Monitor whether the target active window or the target fragment enters an invisible state during its life cycle;
[0015] When the target active window or the target fragment enters an invisible state during its life cycle, the path configuration information of the target view is deleted from the global path.
[0016] Optionally, when the target active window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path includes:
[0017] When the target active window or the target fragment enters an invisible state during its life cycle, in response to a stop event of the target view, the path configuration information of the target view is deleted from the global path.
[0018] Optionally, the path configuration information includes the path identifier, path level, and view information of the target view;
[0019] Accordingly, when the target active window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and the preset root path information, including:
[0020] When the target active window or the target fragment enters a visible state during its life cycle, acquiring path configuration information and a global path of a target view applied by the target active window or the target fragment;
[0021] When the global path includes different path identifiers at the same path level of the target view, the global path is updated based on the path identifier, path level and view information of the target view and preset root path information.
[0022] Optionally, the method further includes:
[0023] When the global path does not include the path level of the target view, a global path representing the path of the target view is generated based on the path identifier and path level of the target view and preset root path information.
[0024] Optionally, the method further includes:
[0025] When the target active window or the target fragment is in a visible state in the life cycle, in response to a click event of the target view, a global path representing the target view path is reported.
[0026] According to a specific embodiment of the present application, in a second aspect, the present application provides a device for obtaining a view path, comprising:
[0027] A configuration unit, used to configure the path configuration information of the target view applied to the target active window or target fragment in the target application through the annotation processor;
[0028] A first monitoring unit is configured to monitor whether the target active window or the target fragment enters a visible state during the life cycle of the target application;
[0029] An obtaining unit is used to obtain the path configuration information of the target view applied by the target active window or the target fragment when the target active window or the target fragment enters a visible state during its life cycle, and obtain a global path representing the target view path based on the path configuration information and the preset root path information.
[0030] Optionally, when the target active window or the target fragment enters a visible state during its life cycle, obtaining path configuration information of a target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information, includes:
[0031] When the target active window or the target fragment enters a visible state during its life cycle, in the refresh event of the target view, the path configuration information of the target view applied by the target active window or the target fragment is obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information.
[0032] Optionally, the device further includes:
[0033] A second monitoring unit is configured to monitor whether the target active window or the target fragment enters an invisible state during the life cycle of the target application;
[0034] The deleting unit is configured to delete the path configuration information of the target view from the global path when the target active window or the target fragment enters an invisible state during its life cycle.
[0035] Optionally, when the target active window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path includes:
[0036] When the target active window or the target fragment enters an invisible state during its life cycle, in response to a stop event of the target view, the path configuration information of the target view is deleted from the global path.
[0037] Optionally, the path configuration information includes the path identifier, path level, and view information of the target view;
[0038] Accordingly, when the target active window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and the preset root path information, including:
[0039] When the target active window or the target fragment enters a visible state during its life cycle, acquiring path configuration information and a global path of a target view applied by the target active window or the target fragment;
[0040] When the global path includes different path identifiers at the same path level of the target view, the global path is updated based on the path identifier, path level and view information of the target view and preset root path information.
[0041] Optionally, the device further includes:
[0042] A generating unit is configured to generate a global path representing a target view path based on the path identifier and path level of the target view and preset root path information when the global path does not include the path level of the target view.
[0043] Optionally, the device further includes:
[0044] A reporting unit is configured to report a global path representing a target view path in response to a click event of the target view when the target active window or the target fragment is in a visible state during its life cycle.
[0045] According to a specific embodiment of the present application, in a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for obtaining the view path as described in any one of the above items.
[0046] According to the specific implementation of the present application, in a fourth aspect, the present application provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the method for obtaining the view path as described in any of the above items.
[0047] Compared with the prior art, the above solution of the embodiment of the present application has at least the following beneficial effects:
[0048] The present application provides a method, device, medium and electronic device for obtaining a view path. The present application uniformly manages the path configuration information of the target view applied by the target active window or target fragment in the target application through an annotation processor. The annotation processor can generate corresponding code from the path configuration information of the target view during compilation. During the operation of the target application, when it is monitored that the target active window or the target fragment enters a visible state in the life cycle, the path configuration information of the target view is automatically obtained, and a global path representing the target view path is obtained based on the path configuration information and the preset root path information. This avoids manual input and maintenance of the target view path of the target view applied by the target active window or target fragment in the target application during the programming process, and avoids omitting or writing wrong related code, which leads to application problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] FIG1 shows a flow chart of a method for obtaining a view path according to an embodiment of the present application;
[0050] FIG2 shows a unit block diagram of a device for acquiring a view path according to an embodiment of the present application. DETAILED DESCRIPTION
[0051] To make the objectives, technical solutions, and advantages of this application more clear, this application will be further described in detail below with reference to the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0052] The terms used in the examples of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a," "the," and "the" used in the examples of this application and the appended claims are also intended to include plural forms, and unless the context clearly indicates otherwise, "a plurality" generally includes at least two.
[0053] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.
[0054] It should be understood that although the terms first, second, third, etc. may be used to describe in the embodiments of the present application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, without departing from the scope of the embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0055] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to the determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)," depending on the context.
[0056] It should also be noted that the terms "include," "comprises," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a product or device comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such product or device. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the product or device comprising the element.
[0057] It should be noted in particular that any symbols and / or numbers in the specification that are not marked in the accompanying drawings are not drawing marks.
[0058] The optional embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0059] The embodiment provided in this application is an embodiment of a method for obtaining a view path.
[0060] The embodiment of the present application is described in detail below with reference to FIG1 .
[0061] Step S101 : configuring path configuration information of a target view applied to a target active window or a target fragment in a target application through an annotation processor.
[0062] The Java annotation processor is part of the Java compiler. It can find and process annotations in source code at compile time, providing developers with a powerful tool that allows them to customize Java code at compile time, such as generating additional source code, verifying code specifications, or performing other compile-time operations.
[0063] The core of Java annotation processing is the API in the javax.annotation.processing package. Developers can create custom annotation processors by implementing this API. By implementing the javax.annotation.processing.Processor interface, they can define which annotations the processor can process and provide processing logic, such as generating new class files and validating code.
[0064] The annotation processor can also edit, configure and manage the path configuration information of the target view applied by the target active window (i.e., Activity) or target fragment (i.e., Fragment) in the target application. The annotation processor runs at a specific stage of the compilation process, that is, before the source code is compiled into bytecode. The embodiment of the present application uses the annotation processor to uniformly manage the path configuration information of the target view applied by the target active window (i.e., Activity) or target fragment (i.e., Fragment) in the target application. Avoid manual input and maintenance of the target view path of the target view applied by the target active window or target fragment in the target application during the programming process, omission or incorrect writing of relevant code, and problems with the application.
[0065] A fragment represents a portion of a behavior or interface within a FragmentActivity. Multiple fragments can be combined within a single activity to create a multi-pane interface, and a fragment can be reused across multiple activities. Fragments can be considered modular components of an activity. They have their own lifecycle, receive their own input events, and can be added or removed while the activity is running.
[0066] Fragments (i.e., fragments) must always be hosted in an activity window (i.e., an activity), and their lifecycle is directly affected by the lifecycle of the host activity window (i.e., the activity). For example, when the activity window (i.e., the activity) is paused, all fragments (i.e., fragments) of the activity window (i.e., the activity) are also paused; when the activity window (i.e., the activity) is destroyed, all fragments (i.e., fragments) are also destroyed.
[0067] While the activity is running (in the resumed lifecycle state), each fragment can be manipulated independently, such as adding or removing fragments. When a fragment transaction is executed, it is added to the back stack managed by the activity. Each back stack entry in the activity is a record of a fragment transaction. The back stack allows users to undo fragment transactions (go back) by pressing the back button.
[0068] A fragment must always be embedded in an activity window (i.e., an activity), and the lifecycle of the fragment is affected by the activity window (i.e., an activity). When the activity window (i.e., an activity) is paused, all fragments (i.e., fragments) in the activity window (i.e., an activity) will be destroyed and released.
[0069] The path configuration information includes the path identifier, path level and view information of the target view.
[0070] In the embodiment of the present application, the root path information (e.g., " / main") where the target application is located is path level 0. If there is at least one subdirectory under the path at path level 0, then these subdirectories all belong to path level 1, for example, the path identifier is " / list" or " / detail". If there is at least one subdirectory under each path at path level 1, then these subdirectories all belong to path level 2, for example, the path identifier is " / list / a" or " / detail / b". ...and so on.
[0071] Step S102a: During the running of the target application, monitoring is performed to determine whether the target active window or the target fragment enters a visible state during its life cycle.
[0072] The annotation processor can generate corresponding code from the path configuration information configured above during compilation. The embodiment of the present application automatically obtains the target view path of the target view in the target active window or target fragment by running the target application.
[0073] In the embodiment of the present application, whether the target active window or the target fragment enters the visible state during the life cycle is monitored by a monitoring method (such as a callback method).
[0074] The target active window or the target fragment enters a visible state during its life cycle, which can be understood as the target active window or the target fragment entering an operable state during its life cycle.
[0075] Step S103, when the target active window or the target fragment enters a visible state during its life cycle, obtain the path configuration information of the target view applied by the target active window or the target fragment, and obtain a global path representing the target view path based on the path configuration information and the preset root path information.
[0076] In the embodiment of the present application, the path configuration information of the target view applied by the target active window or target fragment in the target application is uniformly managed by the annotation processor. When compiling, the annotation processor can generate corresponding code from the path configuration information of the target view. During the operation of the target application, when it is monitored that the target active window or the target fragment enters a visible state in the life cycle, the path configuration information of the target view is automatically obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information. This avoids manual input and maintenance of the target view path applied by the target active window or target fragment in the target application during the programming process, and avoids omitting or writing wrong relevant code, which leads to problems in the application.
[0077] In some specific embodiments, when the target active window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information includes the following steps:
[0078] Step S103a, when the target active window or the target fragment enters a visible state during its life cycle, in the refresh event of the target view, the path configuration information of the target view applied by the target active window or the target fragment is obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information.
[0079] The path configuration information includes the path identifier, path level and view information of the target view.
[0080] In this specific embodiment, when the target active window or the target fragment enters a visible state during its life cycle, a refresh event of the target view (i.e., a refresh of the target view and an update of the data) must be generated. For example, the function of the onResume event of the target view is to refresh the target view and update the data when the Activity or Fragment enters a visible state. In the onResume event of the target view, the path configuration information of the target view applied by the target active window or the target fragment is obtained: the path identifier of the target view is " / list", the path level is level 1, and the view information is "list.html"; the preset root path information is " / main", and the global path obtained is " / main / list / list.html", which is the target view path. Therefore, when a refresh event of the target view is generated, the global path representing the target view path can be obtained at the fastest time point.
[0081] In some specific embodiments, during the operation of the target application, the following steps are further included:
[0082] Step S102b: monitoring whether the target active window or the target fragment enters an invisible state during its life cycle.
[0083] Step S103b: when the target active window or the target fragment enters an invisible state during its life cycle, the path configuration information of the target view is deleted from the global path.
[0084] The target active window or the target fragment enters an invisible state during its life cycle, which can be understood as the target active window or the target fragment entering an inoperable state during its life cycle.
[0085] Deleting the path configuration information of the target view from the global path can be understood as: once the target active window or the target fragment enters an invisible state during its life cycle, the path configuration information of the target view will no longer be included in the global path.
[0086] In some specific embodiments, when the target active window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path includes the following steps:
[0087] Step S103c: when the target active window or the target fragment enters an invisible state during its life cycle, in response to a stop event of the target view, deleting the path configuration information of the target view from the global path.
[0088] In this specific embodiment, when the target activity window or the target fragment enters an invisible state during its life cycle, a stop event of the target view must be generated. For example, the function of the onStop event of the target view is to stop the activity of the Activity or Fragment when the Activity or Fragment enters an invisible state; in the onStop event of the target view, the global path is " / main / list / list.html", wherein the path identifier of the target view is " / list", the path level is level 1 path level, and the view information is "list.html". The global path after deleting the path configuration information of the target view is " / main".
[0089] When a stop event of a target view is generated, the path configuration information of the target view can be deleted from the global path to ensure the consistency of the association between the global path and the active page.
[0090] In some specific embodiments, the path configuration information includes the path identifier, path level, and view information of the target view.
[0091] Accordingly, when the target active window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and the preset root path information, includes the following steps:
[0092] Step S103d-1: When the target active window or the target fragment enters a visible state during its life cycle, the path configuration information and the global path of the target view applied by the target active window or the target fragment are obtained.
[0093] Step S103d-2a: when the global path includes different path identifiers at the same path level of the target view, the global path is updated based on the path identifier, path level and view information of the target view and preset root path information.
[0094] In this specific embodiment, if the target active window or the target fragment enters a visible state during its life cycle, and the global path includes different path identifiers at the same path level of the target view, the global path is updated to the target view path. For example, if the global path is " / main / list / list.html", the path identifier of the target view is " / list", and the path level is level 1; if the target view path is " / main / detail / detail.html", the path identifier of the target view is " / detail", and the path level is level 1, the global path is updated to " / main / detail / detail.html". This ensures the consistency of the association between the global path and the active page.
[0095] In some specific embodiments, the method further comprises the following steps:
[0096] Step S103d-2b: when the global path does not include the path level of the target view, a global path representing the path of the target view is generated based on the path identifier and path level of the target view and preset root path information.
[0097] For example, the global path is " / main" and the path level is path level 0. If the path identifier of the target view is " / list" and the path level is path level 1, the global path does not include the path level of the target view, then the global path representing the target view path is " / main / list / list.html".
[0098] In some specific embodiments, the method further comprises the following steps:
[0099] When the target active window or the target fragment is in a visible state in the life cycle, in response to a click event of the target view, a global path representing the target view path is reported.
[0100] In this specific embodiment, when the target active window or the target fragment is in a visible state during its life cycle, the global path representing the target view path is reported through a click event of the target view, so that developers can quickly locate the target view.
[0101] The present application also provides an apparatus embodiment that is based on the above embodiment, and is used to implement the method steps described in the above embodiment. The interpretation based on the same name meaning is the same as that of the above embodiment, and has the same technical effect as the above embodiment, and will not be repeated here.
[0102] As shown in FIG2 , the present application provides a view path acquisition device 200, comprising:
[0103] A configuration unit 201 is configured to configure path configuration information of a target view applied to a target active window or a target fragment in a target application through an annotation processor;
[0104] The first monitoring unit 202 is configured to monitor whether the target active window or the target fragment enters a visible state during the life cycle of the target application;
[0105] The obtaining unit 203 is used to obtain the path configuration information of the target view applied by the target active window or the target fragment when the target active window or the target fragment enters a visible state during its life cycle, and obtain a global path representing the target view path based on the path configuration information and the preset root path information.
[0106] Optionally, when the target active window or the target fragment enters a visible state during its life cycle, obtaining path configuration information of a target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information, includes:
[0107] When the target active window or the target fragment enters a visible state during its life cycle, in the refresh event of the target view, the path configuration information of the target view applied by the target active window or the target fragment is obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information.
[0108] Optionally, the device further includes:
[0109] A second monitoring unit is configured to monitor whether the target active window or the target fragment enters an invisible state during the life cycle of the target application;
[0110] The deleting unit is configured to delete the path configuration information of the target view from the global path when the target active window or the target fragment enters an invisible state during its life cycle.
[0111] Optionally, when the target active window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path includes:
[0112] When the target active window or the target fragment enters an invisible state during its life cycle, in response to a stop event of the target view, the path configuration information of the target view is deleted from the global path.
[0113] Optionally, the path configuration information includes the path identifier, path level, and view information of the target view;
[0114] Accordingly, when the target active window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied by the target active window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and the preset root path information, including:
[0115] When the target active window or the target fragment enters a visible state during its life cycle, acquiring path configuration information and a global path of a target view applied by the target active window or the target fragment;
[0116] When the global path includes different path identifiers at the same path level of the target view, the global path is updated based on the path identifier, path level and view information of the target view and preset root path information.
[0117] Optionally, the device further includes:
[0118] A generating unit is configured to generate a global path representing a target view path based on the path identifier and path level of the target view and preset root path information when the global path does not include the path level of the target view.
[0119] Optionally, the device further includes:
[0120] A reporting unit is configured to report a global path representing a target view path in response to a click event of the target view when the target active window or the target fragment is in a visible state during its life cycle.
[0121] In the embodiment of the present application, the path configuration information of the target view applied by the target active window or target fragment in the target application is uniformly managed by the annotation processor. When compiling, the annotation processor can generate corresponding code from the path configuration information of the target view. During the operation of the target application, when it is monitored that the target active window or the target fragment enters a visible state in the life cycle, the path configuration information of the target view is automatically obtained, and the global path representing the target view path is obtained based on the path configuration information and the preset root path information. This avoids manual input and maintenance of the target view path applied by the target active window or target fragment in the target application during the programming process, and avoids omitting or writing wrong relevant code, which leads to problems in the application.
[0122] This embodiment provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method steps described in the above embodiment.
[0123] An embodiment of the present application provides a non-volatile computer storage medium, which stores computer-executable instructions. The computer-executable instructions can execute the method steps described in the above embodiment.
[0124] Finally, it should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. References to the common and similar parts between the various embodiments will be sufficient. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, their descriptions are relatively simple; for relevant details, refer to the descriptions of the methods.
[0125] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for obtaining a view path, characterized in that Including: Configuring path configuration information of a target view applied to a target activity window or a target fragment in a target application through an annotation processor; During the running of the target application, listening for whether the target activity window or the target fragment enters a visible state during its life cycle; When the target activity window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied to the target activity window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information.
2. The method according to claim 1, wherein The step of, when the target activity window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied to the target activity window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information, includes: When the target activity window or the target fragment enters a visible state during its life cycle, in the refresh event of the target view, obtaining the path configuration information of the target view applied to the target activity window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information.
3. The method according to claim 1, wherein During the running of the target application, it further includes: Listening for whether the target activity window or the target fragment enters an invisible state during its life cycle; When the target activity window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path.
4. The method according to claim 3, characterized in that, The step of, when the target activity window or the target fragment enters an invisible state during its life cycle, deleting the path configuration information of the target view from the global path, includes: When the target activity window or the target fragment enters an invisible state during its life cycle, in response to the stop event of the target view, deleting from the global path the path configuration information of the target view.
5. The method according to claim 1, wherein: The path configuration information includes a path identifier, a path level, and view information of the target view; Accordingly, the step of, when the target activity window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied to the target activity window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and preset root path information, includes: When the target activity window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information and the global path of the target view applied to the target activity window or the target fragment; When different path identifiers at the same path level of the target view are included in the global path, updating the global path based on the path identifier, the path level, and the view information of the target view and the preset root path information.
6. The method according to claim 5, wherein The method further includes: When the global path does not include the path level of the target view, a global path representing the target view path is generated based on the path identifier and path level of the target view and the preset root path information.
7. The method according to claim 1, wherein The method further includes: When the target activity window or the target fragment is in a visible state during its life cycle, in response to a click event on the target view, report the global path representing the target view path.
8. An apparatus for obtaining a view path, characterized in that, It includes: A configuration unit for configuring, through an annotation processor, the path configuration information of the target view applied to the target activity window or the target fragment in the target application; A first monitoring unit for monitoring, during the running of the target application, whether the target activity window or the target fragment enters a visible state during its life cycle; An obtaining unit for, when the target activity window or the target fragment enters a visible state during its life cycle, obtaining the path configuration information of the target view applied to the target activity window or the target fragment, and obtaining a global path representing the target view path based on the path configuration information and the preset root path information. When the program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, It includes:
10. An electronic device, characterized in that, One or more processors; A storage device for storing one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Mobile business module componentization configuration method and system
CN107908403A
Method and apparatus for routing hopping
CN108897612A
Application modularization and routing jump method
CN110262797A
Bytecode file generation method and device, page jumping method and device and computer equipment
CN116028061A
View path acquisition method and device, medium and electronic equipment
CN118012426A