Interface loading method, electronic equipment and storage medium

By preloading and storing ListView's view objects, the problem of long interface loading time caused by frequent generation and recycling of list item views is solved, and faster interface loading speed and better user experience is achieved.

CN119493610APending Publication Date: 2025-02-21HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311050460.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-18
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

When the user scrolls the ListView component up and down, frequent generation and recycling of list item views lead to long loading time for the interface and poor user experience.

Method used

By preloading and storing the ListView's view object, when the user switches the interface, a new interface is generated based on the stored view object, thereby reducing the number of repeated views.

Benefits of technology

It effectively shortens the time for list item view generation, improves interface loading speed and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493610A_ABST
    Figure CN119493610A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of intelligent terminals, in particular to an interface loading method, electronic equipment and a storage medium, a first display interface is displayed, and the first display interface comprises first display content corresponding to a first list item view of a first list view; detecting a first switching operation of switching to a second display interface, wherein the second display interface comprises second display content corresponding to a second list item view of the second list view; determining a first view object corresponding to a second list item view of a second list view stored in the electronic equipment; and generating a second display interface based on the stored first view object. Therefore, the number of reusable view objects is large, and the duration for generating the list item view is effectively shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent terminals, and in particular to an interface loading method, an electronic device and a computer-readable storage medium. Background Art

[0002] ListView is an interface component used to display a collection of vertically scrollable list item views, where each list item view is located directly below the previous list item view in the list. For example, in an instant messaging application, the ListView component can be used to display multiple friends or multiple communication messages in a list format, where the rectangular area displaying each communication message is a list item view.

[0003] When the user scrolls up and down the interface displayed by the ListView component, the list item views that exceed the screen range will be recycled, and the top or end of the interface needs to display a new list item view. For example, you can obtain the resource file corresponding to the interface content to be displayed to generate a new list item view. However, if the list item view is regenerated based on the resource file for each slide, it will take a long time to load the new list item view, causing the user to feel stuck during the interface loading process, reducing the user experience. Summary of the invention

[0004] In view of this, the present application provides an interface loading method, an electronic device, and a computer-readable storage medium, by displaying a first interface, the first display interface includes a first display content corresponding to a first list item view of a first list view; detecting a first switching operation to switch to a second display interface, the second display interface includes a second display content corresponding to a second list item view of a second list view; determining a first view object corresponding to a second list item view of a second list view stored in the electronic device; and generating a second display interface based on the stored first view object. Thus, more view objects can be reused, effectively shortening the time for generating list item views.

[0005] In a first aspect, the present application provides an interface loading method, the method comprising: displaying a first display interface, the first display interface including first display content corresponding to a first list item view of a first list view; detecting a first switching operation to switch to a second display interface, the second display interface including second display content corresponding to a second list item view of a second list view; determining a first view object corresponding to the second list item view of a second list view that has been stored in the electronic device; and generating a second display interface based on the stored first view object.

[0006] That is, the first display interface (i.e., the second interface hereinafter) includes a first list view, the first list view is of ListView layout style, and the first list view includes a first list item view (i.e., any one of the multiple list item views in the second interface). When a first switching operation to switch to the second display interface (i.e., the first interface hereinafter) is detected, it is determined that the electronic device has stored a first view object corresponding to the second list item view of the second list view (i.e., the first display area of ​​ListView style hereinafter), and it can be determined that the first view object has been preloaded and has not been deleted, for example, the first view object has not been overwritten by the view object of the second interface, and the first interface can be generated directly based on the stored first view object.

[0007] Therefore, when the electronic device switches from the first interface to the second interface, if the second interface includes a second display area based on the ListView layout, the electronic device will not delete the view object corresponding to the list item view corresponding to the first display area of ​​the first interface. In this way, the electronic device can also generate the first interface based on the stored view object when displaying the first interface next time (for example, detecting the above-mentioned first switching operation). Thereby, more view objects can be reused, which effectively shortens the time of generating the list item view.

[0008] In a possible implementation of the first aspect, a method for acquiring a first view object corresponding to a second list item view of a stored second list view includes: determining that the electronic device does not store the first view object, and generating and storing the first view object.

[0009] That is, when the second display interface (hereinafter referred to as the first interface) is entered once, if it is determined that the electronic device does not store the first view object corresponding to the second list item view of the second list view, it is necessary to generate and store the first view object, for example, by loading a resource file to generate the first view object and store it in the electronic device. So that when the second display interface (hereinafter referred to as the first interface) is entered again by the above-mentioned first switching operation, the first view object required to generate the list item view can be directly obtained without generating the first view object twice. As a result, more view objects can be reused, effectively shortening the time for generating the list item view.

[0010] In a possible implementation of the first aspect above, the first view object will not be deleted within a first time threshold.

[0011] That is, the first view object can be stored in the electronic device within the first time threshold, for example, it can be stored for 3 days, or 5 days. In some embodiments, the first view object can be stored in the storage space of the internal memory of the electronic device within the second time threshold, and transferred to the disk storage space of the electronic device after the second time threshold is met, and the first view object is deleted after the storage time meets the first time threshold, so as to avoid excessive occupation of the internal memory space of the electronic device.

[0012] For example, the first view object can be stored in the storage space of the internal memory of the electronic device for 70 minutes, and transferred to the disk storage space of the electronic device after 70 minutes. The first view object is deleted from the disk after 3 days or 5 days after being transferred to the disk memory space of the electronic device, so as to avoid excessive occupation of the internal memory space of the electronic device.

[0013] In a possible implementation of the first aspect above, determining a first view object corresponding to a second list item view of a second list view already stored in an electronic device includes: using a first thread to determine the first view object corresponding to a second list item view of a second list view already stored in the electronic device, wherein the first thread is established when an application corresponding to the second display interface is started.

[0014] That is, the first view object stored in the electronic device can be obtained through the first thread (ie, the preloading thread hereinafter), which is established when the application (ie, the first application hereinafter) corresponding to the second display interface (ie, the first interface) is started.

[0015] In some embodiments, the preloading thread may also determine whether the first interface includes a first display area of ​​a ListView layout to start preloading processing of the first view object.

[0016] In a possible implementation of the first aspect above, determining that the electronic device does not store the first view object, generating and storing the first view object, includes: using a first thread to determine that the electronic device does not store the first view object; and using the first thread to generate and store the first view object according to a resource file corresponding to the second list item view.

[0017] That is, the preloading thread can be used to determine that the electronic device does not store the first view object, and the preloading thread can generate and store the first view object according to the resource file corresponding to the second list item view, thereby completing the preloading of the first view object. The preloading thread is decoupled from the second thread (i.e., the view generation thread) and can be executed asynchronously. This avoids repeatedly loading resource files during the view generation process, reduces the number of calls to the loading function for loading resource files, and effectively shortens the time required to generate the list item view.

[0018] In a possible implementation of the first aspect, generating a second interface based on a stored first view object includes: establishing a second thread after the first switching operation is completed; and generating a second display interface based on the stored first view object using the second thread.

[0019] That is, after detecting that the first switching operation is completed, a second thread (i.e., a view generation thread) can be established, and the second display interface (i.e., the first interface) can be generated based on the stored first view object through the view generation thread. The view generation thread is decoupled from the preloading thread mentioned above and can be executed asynchronously. This avoids repeatedly loading resource files in the process of generating views, reduces the number of calls to the loading function for loading resource files, and effectively shortens the time for generating list item views.

[0020] In a possible implementation of the first aspect above, storing the first view object includes: determining a first activity corresponding to the second interface; and storing the first view object in a view object set corresponding to the first activity.

[0021] That is, when the view generation thread obtains the stored first view object, it can find the corresponding view object set based on the first activity and then obtain the first view object, thereby avoiding traversing all stored view objects when searching for the first view object, and speeding up the search process of the view generation thread to obtain the stored first view object.

[0022] In a possible implementation of the first aspect, storing the first view object includes: storing the first view object in a key-value database or a global variable.

[0023] That is, the first view object can be stored in the form of a key-value database or a global variable to prevent the first view object from being covered by other view objects. For example, a first view object library is established in the form of a key-value database or a global variable in the memory control of the electronic device, and the first view object is stored in the first view object library, so that the view generation thread can obtain the stored first view object.

[0024] In a second aspect, the present application also provides an electronic device, comprising: one or more processors; one or more memories; one or more memories storing one or more instructions, and when one or more instructions are executed by one or more processors, the electronic device executes any possible interface loading method of the first aspect mentioned above.

[0025] In a third aspect, the present application further provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, causes the computer to execute any possible interface loading method of the first aspect described above.

[0026] In a fourth aspect, an embodiment of the present application discloses a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any possible interface loading method of the first aspect described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1A A schematic diagram of a scene of a display interface is shown;

[0028] Figure 1B A schematic diagram of a page turning scenario is shown;

[0029] Figure 1C A schematic diagram of a scenario of overlaying a cache view is shown;

[0030] Figure 2A A schematic diagram of a view generation process is shown;

[0031] Figure 2B According to an embodiment of the present application, a schematic diagram of a data structure of a preset view object library is shown;

[0032] Figure 2C A schematic diagram of a scene with different view attributes is shown;

[0033] Figure 3A According to an embodiment of the present application, a schematic diagram of a flow chart of an interface loading method is shown;

[0034] Figure 3B According to an embodiment of the present application, a schematic diagram of a dual-thread view generation process is shown;

[0035] Figure 4 According to an embodiment of the present application, a software structure block diagram of an electronic device 100 is shown;

[0036] Figure 5 According to an embodiment of the present application, a schematic diagram of an implementation flow of an interface loading method is shown;

[0037] Figure 6 According to an embodiment of the present application, a schematic diagram of a specific implementation process of updating a preset view object library is shown;

[0038] Figure 7 According to an embodiment of the present application, a schematic diagram of a specific implementation process of view component reuse is shown;

[0039] Fig. 8A A schematic diagram of a process of generating a view in a single thread is shown;

[0040] Figure 8B According to an embodiment of the present application, another schematic diagram of a process of generating a view by dual threads is shown;

[0041] Fig.9AA schematic diagram showing the time taken for the interface to load when entering the interface for the first time is shown;

[0042] Fig. 9B A schematic diagram showing the layout time when entering the interface for the first time is shown;

[0043] Fig. 9C A schematic diagram showing the layout time when there are a large number of views is shown;

[0044] Fig.9D A schematic diagram of layout time when there are more views is shown;

[0045] Fig. 10A According to an embodiment of the present application, a schematic diagram of the time taken for loading an interface when entering the interface for the first time is shown;

[0046] Fig. 10B According to an embodiment of the present application, a schematic diagram of layout time when entering the interface for the first time is shown;

[0047] Fig. 10C According to an embodiment of the present application, a schematic diagram of the interface loading time of a secondary entry interface is shown;

[0048] Fig.11 According to an embodiment of the present application, a hardware structure diagram of an electronic device 100 is shown. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0050] The illustrative embodiments of the present application include, but are not limited to, an interface loading method, an electronic device, and a computer-readable storage medium, etc.

[0051] It can be understood that the electronic devices to which the present application is applicable may be mobile phones, tablet computers, desktops, laptops, handheld computers, netbooks, augmented reality (AR) / virtual reality (VR) devices, smart TVs, smart watches, etc., as well as other electronic devices in which one or more processors are embedded or coupled, without limitation herein.

[0052] In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, the meanings of some related field terms involved in the embodiments of the present application are explained below.

[0053] (1) Activity: It is a key component of an application. It can provide a window for the application to draw the interface. It serves as the entry point for the application to interact with the user. Different scenarios can be set as different activities, so that the application provides different interfaces for the user. For example, if you open the email application from the home screen, the activity corresponding to this path provides the user with an email list interface; if you start the email application through a social media application, the activity corresponding to this path provides the user with an email writing interface of the email application. The window provided by the activity for drawing the interface usually fills the screen, but it may also be smaller than the screen or float on top of other windows. For example, one activity in an instant messaging application is used to present chat history, and another activity is used to present the address book.

[0054] (2) Layout: A layout defines the interface structure of an application that displays data content (e.g., the interface structure of an activity). All elements in a layout are constructed using a hierarchy of view and view group objects. Views are usually used to draw content that users can see and interact with. View groups are invisible containers that define the layout structure of views and other view group objects.

[0055] It should be noted that each view object and view group object supports its own various extensible markup language (XML) attributes, which can be regarded as layout parameters, that is, attributes that describe the specific layout direction of the view object. Furthermore, when drawing each view, it is necessary to convert the XML resource object of each view into a view class object (hereinafter referred to as loaded resource file) so that the function used to generate the view can use the view class object to draw the corresponding view.

[0056] (3) View: A view represents a rectangular area on the screen, which is used for drawing the area and event processing. It can be understood that the geometric shape of a view is the geometric shape of a rectangle. Therefore, a view has a position (expressed by a pair of "horizontally left" and "vertically up" coordinates) and two sizes (expressed by width and height). The above position and size are the layout parameters of the view, which can be expressed through XML attributes. The units of position and size are pixels.

[0057] (4) Adapter: The adapter is used to associate the data items that each view needs to display with the list item view so that the data can be displayed correctly.

[0058] (5) List item view: Each data item (e.g., each row) in the list view corresponds to a list item view (i.e., a view corresponding to each data item in the ListView), which is used to display the specific data content. The list item view usually contains multiple controls (such as TextView, ImageView, etc.) to display the various properties of the data item.

[0059] The following takes mobile phone 00 as an example to introduce the scenario of displaying an interface in an electronic device.

[0060] Figure 1A A schematic diagram of a scene of a display interface is shown.

[0061] refer to Figure 1A , mobile phone 00 displays interface 01, which displays list item view 0 to list item view 1 in List View component. Figure 5 There are 6 list item views in total. The view set formed by the above 6 list item views can be scrolled vertically. Each list item view is located directly below the previous list item view in the list, for example, list item view 1 is directly below list item view 0. List View does not contain specific content (such as text, images and other filler content). For example, in an instant messaging application, the layout style of each chat record can be included, but the message content data of the chat record is not included.

[0062] As you can see, List View can display new list item views when the user scrolls up or down. Figure 5 The new list item view below (for example, the list item view Figure 6 ), the interface 01 can be swiped up. The mobile phone 00 detects the user's swiping up operation 10, and the list item view 0 at the top of the interface no longer needs to be displayed, so it can be recycled to a designated storage location (such as a recycle bin) for cache. Then, a new list item view is generated at the bottom of the interface 01, for example, the list item view is taken out from the designated storage location. Figure 6 To draw on the list item view Figure 5 Below.

[0063] It is understood that if the specified storage location does not contain the list item view that needs to be newly loaded Figure 6 , you need to reload the view resources from the resource file to generate a new list item view. For example, you need to regenerate the list item view based on the downloaded XML format resource file.

[0064] In some implementations, if the user exits interface 01 and enters a new interface 02, the cached list item view of interface 01 will be overwritten by the list item view of the new interface 02. Figure 1B , the mobile phone 00 detects the user's left sliding operation 20 on the interface 01, and displays a new interface 02 in response to the operation 20. The list item view 0 in the interface 01 to the list item view Figure 5 are cached in the recycle bin, then after entering interface 02, the list item view 0A and list item view Figure 1A Will overwrite the cached list item view 0 to the list item view Figure 5 For example, refer to Figure 1C , the cached list item view 0 and list item view 1 are cached by list item view 0A and list item view Figure 1A At this time, if the interface 01 is started according to the new user operation, the overwritten historical list item view 0 and list item view 1 cannot be taken out from the recycle bin, and the overwritten historical list item view needs to reload the resource file to generate the list item view, resulting in a long time for the generation of the list item view in the interface.

[0065] In addition, in the process of generating a single list item view, a loading function (such as an inflate function) for loading resource files needs to be repeatedly executed, which also causes the generation of the list item view to take a long time.

[0066] It can be understood that the generation process of a single view in a view component usually includes multiple steps, such as measurement, layout, drawing, etc. Usually when drawing a view, if there is no reusable view (for example, the properties of the cached view class object are inconsistent with the properties of the view to be drawn), it is necessary to load the resource file (for example, the coordinate parameters required for measurement) → measurement → load the resource file (for example, the relative layout or linear layout parameters required for layout) → layout → drawing. For example, refer to Figure 2A, thread 02 is used to execute the drawing process of the list item view, which includes three steps: step 021 is to call the onMeasure function to measure the window size, step 022 is to call the onLayout function to perform layout processing, and step 023 is to call the onDraw function to draw the list item view. Among them, step 021 and step 022 each include the process of loading resource files to obtain view objects. For example, in the process of executing the onMeasure function in step 021, it is necessary to execute the inflate function at least once to load the resource file to obtain the corresponding view object (such as the window size of the list item view), and then continue to execute other business logics of the onMeasure function to complete the measurement of the window size. For another example, in the process of executing the onLayout function in step 022, it is necessary to execute the inflate function at least once to load the resource file to obtain the corresponding view object (such as the layout parameters of the list item view), and then continue to execute other business logics of the onLayout function to complete the layout processing. So that step 023 can execute the onDraw function based on the view elements (i.e., view objects) obtained in steps 021 and 022 to draw the required list item view. Obviously, in the process of drawing the list item view, the loading function for loading the resource file needs to be called multiple times, which will prolong the time taken to generate the list item view.

[0067] In order to solve the problem of too long time to generate views, the present application proposes an interface loading method. In the case where the first interface to be generated includes a first display area based on a ListView layout, the electronic device can preload resource files for generating each list item view in the first display area (for example, the resource file is loaded into the memory of the electronic device). In the process of calling the preloaded resource file to generate each list item view in the first display area, the electronic device can add the view object used when generating the list item view (for example, the view class object obtained by loading the XML resource file) to the memory of the electronic device, and the view object stored in the memory is not deleted within the first time length. When the electronic device detects that the user switches the content of the first display area from the first display content to the second display content (for example, a swipe up or swipe down operation in the first display area), if the first display content is at least partially the same as the second display content (for example, the list item views corresponding to the first display content and the second display content are at least partially the same), the electronic device can generate the second display content based on the view object stored in the memory.

[0068] Furthermore, when the electronic device switches from the first interface to the second interface, if the second interface includes a second display area based on a ListView layout, the electronic device will not delete the view object corresponding to the list item view corresponding to the first display area of ​​the first interface. In this way, the electronic device can also generate the first interface based on the stored view object when displaying the first interface next time.

[0069] On the one hand, the view objects stored in the memory are not deleted within the first duration, for example, the stored view objects are not deleted within three days, and the view objects of the new interface are no longer used to overwrite the historically cached view objects, so that more view objects can be reused, effectively shortening the time for generating the list item view. On the other hand, when it is detected that the first interface to be generated includes a first display area based on the ListView layout, the resource files are preloaded before entering the drawing process of the first display area. When the list item view of the first display area is to be generated, the loaded view objects in the preset view object library are directly obtained to draw the list item view. This can avoid repeatedly loading resource files in the process of generating the view, reduce the number of calls to the loading function for loading resource files, and further shorten the time for generating the list item view.

[0070] It can be understood that the properties of the reusable view object and the list item view to be generated should be the same, such as size parameters, position parameters in the window, type of layout position, view type, etc. For example, refer to Figure 2C When the interface 03 is generated based on the first activity, text views 0 to 5 are stored in the preset view object library. When the interface 03' is generated based on the first activity next time, the view type of text views 1 to 5 is still text view, and the view array corresponding to text views 1 to 5 stored in the preset view object library can be reused (the view objects of multiple list item views can be sequentially assembled into a view array). However, the view type of picture view 0' is different from that of text view 0, and cannot be directly reused. Therefore, the resource file corresponding to picture view 0' needs to be reloaded to generate picture view 0'.

[0071] In some embodiments, the view objects used when generating the list item view can be stored in a preset view object library in the memory of the electronic device, and the preset view object library can be a global variable or a key-value store. The view objects in the preset view object library will not be deleted within the first duration. In this way, the corresponding view arrays in the multiple interfaces with the layout of the list view are retained, which effectively improves the interface drawing speed.

[0072] In some embodiments, activities and view arrays may be stored in pairs in a preset view object library. In the database, activities and view arrays are stored in the form of key-value pairs, with activities as keys, and the values ​​corresponding to each activity being view arrays, each of which includes view objects corresponding to multiple list item views. For example, refer to Figure 2B , when the key is activity 0, the corresponding view array is (view object 0, view object 1, ..., view object n) with a total of (n+1) view objects; for another example, when the key is activity 1, the corresponding view array is (view object a, view object b, ..., view object z) with a total of 26 view objects. It can be understood that the first display area including the ListView layout in the first interface can be determined based on the activity, so it is easy to find all reusable list item views from the preset view object library based on the activity, avoiding traversing all view objects in the preset view object library and reducing the time required for reuse of view objects.

[0073] Therefore, each time an application starts an activity, it can search the preset view object library for the corresponding view object according to the activity. If so, it reuses the view object to draw the list item view; if not, there is a new list item view, and the resource file of the new list item view is loaded to obtain the new view object and store it in the preset view object library. Furthermore, the constantly updated preset view object library makes more and more view objects reusable, shortens the time required for the interface to load the view, and brings users an increasingly smooth experience of interface loading.

[0074] Combine the following Figure 3A The interface loading method in the embodiment of the present application is described in detail.

[0075] Figure 3A According to the embodiment of the present application, a schematic diagram of the interface loading method is shown. It can be understood that Figure 3A The execution entity of each step of the illustrated process may be the electronic device 100 described above, or other electronic devices, and the execution entity of a single step will not be described in detail.

[0076] like Figure 3A As shown, the interaction process includes the following steps:

[0077] S301, when starting a first application, starting a view preloading thread for the first application.

[0078] Exemplarily, the electronic device may detect a user's click / long press operation on a first application icon, confirm that the user intends to launch the first application, launch the first application, and start a preloading thread for a view of the first application.

[0079] S302: When the first interface to be displayed includes a first display area of ​​a list view layout, preload a view object corresponding to the first display area in a preloading thread.

[0080] It can be understood that the first display area includes reusable list item views and non-reusable list item views, wherein the view objects corresponding to the reusable list item views have been stored in the preset view object library, while the view objects corresponding to the non-reusable list item views have not been stored in the preset view object library.

[0081] In the case where the view object corresponding to the list item view exists in the preset view object library, the corresponding list item view can be generated in a subsequent view generation thread based on the view object obtained from the preset view object library.

[0082] In the case where the view object corresponding to the list item view does not exist in the preset view object library, the corresponding resource file (for example, an XML resource file containing view elements such as measurement size data and layout data) can be preloaded to obtain the view object and store it in the preset view object library. For example, the above resource file can be loaded by calling the inflate function to obtain the view object corresponding to the non-reusable list item view.

[0083] S303: When the preloaded view objects corresponding to the first display area include at least one view object that does not exist in the preset view object library, store the view objects that do not exist in the preset view object library into the preset view object library.

[0084] It can be understood that the view objects that do not exist in the preset view object library are stored in the preset view object library so that the views in the preset view object library become more and more complete, thereby improving the loading speed when entering the first interface for the second time.

[0085] S304: Generate a first view layer of the first display area based on the preloaded view object corresponding to the first display area.

[0086] For example, if it is detected that the user has completed the operation of switching the first interface, a view generation thread may be started, and in the view generation thread, a first view layer of the first display area is generated based on the preloaded view object corresponding to the first display area. Figure 3B , you can call the onMeasure function to measure the window size, call the onLayout function to calculate the layout, and call the onDraw function to draw the first view layer. In addition, in the view generation thread, you can directly access the preset view object library to obtain the loaded view array and generate the corresponding first view layer.

[0087] It can be understood that the above steps S303 and S304 can be executed in parallel, sequentially, or in reverse order, and there is no limitation here.

[0088] It can be understood that after other layers for presenting content on the first interface (such as image content layer, text content layer, etc.) are generated, the first view layer and other layers can be synthesized to obtain a complete image of the first interface and displayed to the user.

[0089] Through the above steps S301 to S304, on the one hand, when switching applications, the view array in the preset view object library will not be overwritten, so that there are more reusable view arrays, which effectively improves the interface drawing speed. On the other hand, when the application is started and has not yet entered the interface drawing process, the resource file is preloaded, and when the view in the interface is generated, the loaded view array in the preset view object library is directly obtained, which can avoid repeatedly loading resource files in the process of generating views, reduce the number of calls to the function that loads resource files, and effectively shorten the loading time of the interface.

[0090] Below is an example of Android TM ) system as an example, combined with Figure 4 The analysis process of instant messaging message delay is illustrated by way of example.

[0091] Figure 4 According to an embodiment of the present application, a software structure block diagram of an electronic device 100 is shown.

[0092] refer to Figure 4 The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The layered architecture may divide the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces.

[0093] In some embodiments, the Android system is divided into a multi-layer structure, including, from top to bottom, an application layer 440 , an application framework layer 430 (framework, FWK), an Android runtime (Android runtime) and a system library 420 , a kernel layer (kernel) 410 , and a hardware layer 400 .

[0094] The application layer 440 may include a series of applications, such as a first application 441 and a system user interface 442 (SystemUI). The first application 441 may be any application with a list view interface, such as an instant messaging application. The system user interface 442 (SystemUI), a system application, is used to provide a basic display interface, such as the status bar at the top of the screen, the navigation bar at the bottom of the screen, the quick settings bar of the drop-down interface, the notification bar, the lock screen interface, the volume adjustment dialog box, the screenshot display interface, etc.

[0095] The application framework layer 430 provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer 430 includes some predefined functions. For example, the application framework layer 430 includes a system server 431 and a ListView 432.

[0096] System service 431 is a core system service that can provide various system functions for applications. For example, system service 431 contains an activity manager service (AMS) for managing activities within the system, such as calling back corresponding applications based on input events. Each service exists in the process of system service 431 in the form of a thread.

[0097] ListView 432 includes a function library required for drawing a list view, and can be called by the first application 441 to generate a corresponding list view.

[0098] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0099] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0100] In the embodiment of the present application, the system library 420 may include an input management service 421 for distributing input events obtained from the kernel layer 410 to the application framework layer 430, so that the application framework layer 430 calls corresponding services based on the input events.

[0101] The application layer 440 and the application framework layer 430 run in a virtual machine. The virtual machine executes the Java files of the application layer 440 and the application framework layer 430 as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0102] The kernel layer 410 (kernel layer) provides underlying drivers for various hardware of the electronic device 100, including, for example, a device driver layer 411, an input core layer 412, and an event processing layer 413. In some embodiments, the kernel layer 410 can obtain hardware interrupts detected by the hardware layer 400, and process the hardware interrupts into corresponding input events through the device driver layer 411, the input core layer 412, and the event processing layer 413, for example, processing a user clicking a screen icon as a click event.

[0103] The hardware layer 400 may include various hardware chips of the electronic device, such as the hardware chip of the screen 194, and detect the hardware interrupt corresponding to the user operation. For example, when the user clicks the application icon on the screen, a corresponding hardware interrupt may be generated. Based on the hardware interrupt, the kernel layer 410 may process it as a click event for starting the first application 441.

[0104] It should be noted that although the embodiments of the present application are described using the Android system as an example, its basic principles are also applicable to electronic devices based on operating systems such as "IOS", "Windows" or "Linux".

[0105] The following is an example of the workflow of the software and hardware of the electronic device 100 in conjunction with a scenario in which a user uses the electronic device 100 to display an interface.

[0106] When the screen 194 receives the user's click / drag / slide operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer 410 processes the click operation into an original input event (including the click coordinates of the click operation, the timestamp of the click operation, and other information). The original input event is stored in the kernel layer 410. The application framework layer 440 obtains the original input event from the kernel layer 410 and identifies the control corresponding to the input event. Taking the touch operation as a sliding operation, which is used to switch to the first interface as an example, the system service 431 can pre-start the preloading thread of the view in the first interface. For example, corresponding to the situation where the first display area containing the list view layout is detected in the first interface, the interface of the preset view object library in the internal memory 121 is called, the resource files of the reusable view object and the non-reusable view are loaded, the view object of the non-reusable view is obtained, and the view object of the non-reusable view is stored in the preset view object library in the internal memory 121. When it is detected that the user completes the switching operation to the first interface, the first application 441 starts the view generation process in the main process and calls the interface of ListView432 to start the view generation thread. In the view generation thread, ListView432 uses the loaded view array in the preset view object library to generate the first view layer, wherein the first view layer corresponds to the first display area of ​​the list view layout. ListView432 can draw other layers of the first interface based on the first view layer. Then, SystemUI442 synthesizes the drawn first view layer and other layers into a frame image of the first interface and displays it on the screen 194. Then, by preloading the view array, efficient loading of the first view layer of the first display area is achieved. As a result, the process of loading resource files and the process of drawing the interface can be executed asynchronously, which effectively shortens the drawing time.

[0107] Based on the above Figure 4 The interaction process within the system architecture shown is described in detail below in conjunction with specific embodiments and related drawings to describe the specific implementation process of an interface loading method provided by the present application.

[0108] The specific implementation process of an interface loading method provided by an embodiment of the present application is described in detail below in conjunction with related services.

[0109] Figure 5 According to an embodiment of the present application, a schematic diagram of an implementation flow of an interface loading method is shown.

[0110] Specifically, Figure 5 As shown, the process includes the following steps:

[0111] S501 , the first application 441 calls the interface of the system service 431 in response to a switching operation of the user.

[0112] It can be understood that the startup operation can be a user clicking operation on the icon control of the first application 441. The current activity is the activity generated based on the user operation after the first application 441 is started. An activity corresponds to an interface of a certain application, and then it is determined that the user wants to switch to the first interface and view the first interface. At this time, the first application 441 can call the interface of the system service 431 to enable the system service 431 to generate the current activity (for example, the current activity is generated by the activity management service in the system service), and preload the list item view in the first display interface through the system service 431, and then draw the first view layer of the first interface.

[0113] S502, the system service 431 starts a preloading thread and generates a current activity.

[0114] It should be understood that at this time, the task of generating the view in the first interface has not yet been started (for example, Figure 3B Example view generation task 201B), but a new preloading thread can be created to start the preloading task of the view (for example, the above Figure 3B Example preloading task 201A) to complete the preloading of the list item view object.

[0115] S503, the system service 431 detects a first display area of ​​the first interface corresponding to the current activity that includes a list view layout, and determines a plurality of list item views.

[0116] It is understandable that the system service 431 can detect in the preloading thread whether the first interface of the current activity contains the first display area of ​​the ListView layout. If it does not contain the first display area of ​​the ListView layout, stop Figure 5 Example processing flow: If the first interface includes a first display area of ​​a ListView layout, all list item views included in the first interface may be determined, and the view object of each list item view may be loaded in sequence, so that ListView432 may subsequently draw the first view layer.

[0117] S504: The system service 431 determines, based on a preset view object library, that a plurality of list item views includes a non-reusable list item view.

[0118] Refer to above Figure 2C In the illustrated scenario, if the view type of the view object stored in the preset view object library is consistent with the view attribute of the list item to be loaded, the system service 431 can reuse the loaded view object to generate the list item view to be loaded. If the view attribute of the loaded view is different from the list item view to be loaded, the system service 431 can load the resource file corresponding to the list item view to be loaded, and obtain the view object used to generate the list item view.

[0119] In some embodiments, refer to the above Figure 2B In the scenario illustrated, the system service 431 can first match the view array corresponding to the activity from the preset view object library through the current activity, and check whether each view object in the view array can be reused. If the view object is reusable, the view object in the preset view object library can be directly called when the list item view is subsequently generated. If the view object is not reusable, it is necessary to execute step S505 below to load the view resource file to obtain the view object.

[0120] It can be understood that the view object of the reusable view has been pre-stored in a preset view object library, and the view object can be obtained by accessing the preset view object library.

[0121] In some embodiments, the preset view object library may be a global variable or a key-value database.

[0122] S505, the system service 431 loads the resource file of the non-reusable list item view to obtain the corresponding view object.

[0123] It can be understood that the resource file of the list item view can be a file in XML format, containing the layout information, size information, etc. of the list item view, which defines the size, layout and visual effect of the list item view. By loading the resource file, the resource file can be converted into an object that can be used to generate the list item view. For example, the resource file can be loaded by calling the inflate function, which can convert the data file to be loaded into an object that can be used to generate the list item view, such as instantiating the XML layout file of the view into a view class object.

[0124] S506, the system service 431 stores the view object corresponding to the non-reusable list item view in a preset view object library.

[0125] System service 431 can store the view objects of the non-reusable list item views in the preset view object library. Therefore, each time the application starts an activity, it can search in the preset view object library whether there is a corresponding view array according to the activity. If so, it further determines whether each view object in the view array can be reused. If all view objects can be reused, the view array is reused directly; if not, the non-reusable list item views are loaded as view objects and stored in the preset view object library. Furthermore, the constantly updated preset view object library makes more and more view objects reusable, bringing users an increasingly smooth experience of interface loading.

[0126] S507 , the first application 441 calls the ListView 432 interface in response to the switching operation completed by the user.

[0127] When it is detected that the user completes the switching operation to the first interface, for example, the finger touching the screen leaves the screen, or the sliding operation of the sliding screen stops, the ListView432 interface can be called to generate the first view layer of the first interface.

[0128] S508, ListView432 starts the view generation thread.

[0129] Exemplarily, ListView432 may start a view generation thread to execute steps S509 to S512 below to generate a first view layer corresponding to the first display area.

[0130] It should be understood that the view generation thread and the preloading thread mentioned above may be executed synchronously or asynchronously, and no limitation is made here.

[0131] S509, ListView432 obtains view objects corresponding to multiple list item views in the first display area from the preset object view library.

[0132] For example, ListView432 may obtain view objects corresponding to multiple list item views in the first display area from a preset object view library based on the current activity generated by completing the switching operation. Figure 2B The example key-value database uses activity as the key to retrieve the corresponding view array, and each view array contains multiple view objects.

[0133] S510, ListView432 generates a first view layer corresponding to a first display area according to view objects corresponding to a plurality of list item views.

[0134] It can be understood that steps S501 to S506 above have completed the view loading of the current interface, that is, all list item views in the first display area of ​​the first interface have stored view objects, and the collection of these view objects is the loaded view array.

[0135] For example, ListView 432 may be based on inputting a view object corresponding to a list item view into Figure 3B In the example view generation task 201B, for example, when ListView432 calls the onMeasure function, ListView432 directly accesses the preset view object library to obtain the view object, uses the onMeasure function to calculate the view object to obtain the window size data of the corresponding list item view, and completes the window size measurement. Generate the first view layer.

[0136] In some embodiments, continue to refer to Figure 3B, you can call the onMeasure function, onLayout function, and onDraw function to generate the first view layer.

[0137] S511, ListView432 draws other layers on the first interface except the first view layer.

[0138] For example, ListView432 can associate the content to be presented in the list item view with all list item views through an adapter on the drawn first view layer, and then draw other layers. For example, the text to be presented in the text view, the picture to be presented in the picture view, or the video to be presented in the video view can all exist as a separate layer and be superimposed on the generated first view layer. This allows the user to observe that the content in the first display area of ​​the first interface is presented on the screen in the layout style of the list view.

[0139] S512 , ListView 432 sends the first view layer and other layers to SystemUI 442 .

[0140] Exemplarily, ListView432 may send the first view layer file and other layer files to SystemUI 442, or may send the file paths of the first view layer and other layers to SystemUI 442, which is not limited here.

[0141] S513, SystemUI 442 combines the first view layer and other layers into a first interface, and displays the first interface.

[0142] Exemplarily, by sending the first view layer and other layers to SystemUI 442, SystemUI 442 can stack the first view layer and other layers in sequence to synthesize them into an image corresponding to the first interface, and then display the image of the first interface.

[0143] It can be understood that through the specific implementation of the above steps S501 to S513, during the switching operation when the user switches to the first interface, corresponding to the situation in which the first display area in the first interface contains a list view layout, a preloading thread can be started to preload the view objects of each list item view in the first display area, and the preloaded view objects can be stored in the preset view object library. The view objects in the preset view object library will not be overwritten by the view objects in the new interface when switching to a new interface, ensuring that more comprehensive view objects can be obtained from the preset view object library during the drawing process. In addition, the view preloading process is decoupled from the view generation process, and the preloading thread and the view generation thread can be executed asynchronously or synchronously, so that in the process of preloading the view object, only one loading function (such as the inflate function) needs to be called to obtain the view object corresponding to the list item view. In the view generation thread, there is no need to call the loading function, which avoids the problem of repeated loading of view objects during the view generation process resulting in a long interface loading time.

[0144] Combine the following Figure 6 The specific implementation process of step S506 in the above text is described in detail.

[0145] Figure 6 According to an embodiment of the present application, a schematic diagram of a specific implementation process of updating a preset view object library is shown. It can be understood that Figure 6 The execution entity of each step of the illustrated process may be the electronic device 100 described above, or other electronic devices, and the execution entity of a single step will not be described in detail.

[0146] Understandable, reference Figure 6 , you can retrieve the view array in the preset view object library based on the activity, and then perform a preliminary search based on the activity before matching a single view object, avoiding traversing every view object in the preset view object library and reducing the matching time of the view object.

[0147] The specific implementation process is as follows:

[0148] S601, in response to a user operation of switching to a first interface, generating a current activity.

[0149] It can be understood that the specific implementation of step S601 can refer to step S501 above and will not be repeated here.

[0150] S602: Access a preset view object library.

[0151] It is understandable that the preset view object library can be accessed by calling a preset interface to perform the following step S603 to match whether there is a corresponding activity.

[0152] S603, determine whether the current activity has a corresponding activity in the preset view object library. If there is a corresponding activity, execute S604 to successfully match the view array (i.e., a collection of multiple view objects) in the activity. If there is no corresponding activity, execute step S605 to add the new activity to the preset view object library.

[0153] It can be understood that before matching the current view and the view object, it is possible to first determine whether the activity exists in the preset view object library based on the activity to avoid traversing all view data and shorten the view matching time. If the activity does not exist, it is necessary to add the new activity to the preset view object library, and execute S606 and S607 below to add the view array corresponding to the newly added activity to the preset view object library.

[0154] S604, matching a view array according to the activity.

[0155] It can be understood that the corresponding view array can be matched by finding the corresponding activity. In some embodiments, it is necessary to match the view type of each view in the current activity with the view objects in the view array. If there is a new type of view object (for example, reference Figure 2C If a view 0′ of a picture type that has not appeared before appears, it is necessary to add the loaded view object to the preset view object library after executing the following steps S606 and S607.

[0156] S605, adding a new activity to the preset view object library.

[0157] It can be understood that the new activity is added to the preset view object library, and the new view array corresponding to the new activity can be added to the preset view object library after the first view layer of the first interface is drawn.

[0158] S606, doFrame draws a frame.

[0159] It can be understood that the doFrame function can be called to draw each frame of the first interface image so that the screen 194 can display each frame of the first interface. The doFrame function can include the above Figure 3B The process included in the illustrated task 201B is not described in detail here.

[0160] S607: Add the view object corresponding to the activity to the preset view object library.

[0161] It can be understood that after completing drawing of a frame of the first interface image, multiple view objects in the view array corresponding to the activity of the current frame of the first interface can be added to the preset view object library to complete the update of the preset view object library.

[0162] It can be understood that through the specific implementation process of the above steps S601 to S607, the view array in the preset view object library can be retrieved based on the activity, and then a preliminary search based on the activity is performed before matching a single view object, avoiding traversing each view object in the preset view object library and reducing the matching time of the view object. Furthermore, the constantly updated preset view object library makes more and more reusable view arrays, bringing users an increasingly smooth experience of interface loading.

[0163] Combine the following Figure 7 The specific implementation process of a view component reuse proposed in the embodiment of the present application is described in detail. It can be understood that Figure 7 The execution entity of each step of the illustrated process may be the electronic device 100 described above, or other electronic devices, and the execution entity of a single step will not be described in detail.

[0164] Understandable, reference Figure 7 , the user entering the first interface can be divided into two scenarios. One scenario is that the user enters the first interface containing the first display area of ​​the list view layout for the first time, then multiple resource files corresponding to the first display area are directly loaded to generate multiple view objects, and the multiple view objects are added to the preset view object library; and the other scenario is that the user enters the first interface for the second time, then the user completes the switching operation to the first interface as an indicator, pulls up the preloading thread to preload the view, and when it is detected that the property of the list item view has changed, the view object of the changed list item view in the preset view object library is updated through the background of the preloading thread to obtain an updated view component, and the updated view component is reused in the process of generating the first view layer.

[0165] The specific implementation process is as follows:

[0166] S701, when it is detected that the user enters the first interface for the first time, it is determined whether the first interface includes the first display area of ​​the ListView layout, if so, S702 is executed to add the first interface to the preset view object library. If not, the process ends.

[0167] It can be understood that when it is detected that the user enters the first interface for the first time, that is, the activity corresponding to the first interface has never been started, it is determined whether the first interface includes the first display area of ​​the ListView layout. If the first interface includes the first display area of ​​the ListView layout, the activity corresponding to the first interface can be added to the preset view object library for storage.

[0168] S702: The first interface is added to a preset view object library.

[0169] It can be understood that the electronic device 100 can add view objects of different view types used in the first interface to the preset view object library. When it is detected that the user enters the first interface for the second time, as long as the view type of the list item view in the first interface is the same as the view type of the view object stored in the preset view object library, the view object in the preset view object library can be reused in the current page.

[0170] S703, commonly used views are added to the preset view object library.

[0171] It can be understood that the specific implementation of the above step S703 can refer to the specific implementation process of the above step S506, which will not be repeated here.

[0172] S704, accessing a preset view object library.

[0173] It can be understood that the specific implementation of the above step S704 can refer to the specific implementation process of the above step S602, which will not be repeated here.

[0174] S705, whether the first interface exists in the preset view object library.

[0175] It can be understood that the specific implementation of the above step S705 can refer to the specific implementation process of the above step S603, which will not be repeated here.

[0176] S706, reuse the view array of the first interface in the preset view object library.

[0177] It can be understood that the specific implementation of the above step S706 can refer to the specific implementation process of the above step S509, which will not be repeated here.

[0178] S707, entering the first interface.

[0179] It can be understood that the specific implementation of the above step S707 can refer to the specific implementation process of the above step S507, which will not be repeated here.

[0180] S708, asynchronous task creation.

[0181] It can be understood that asynchronous tasks include reference Figure 3B The example preloading task 201A and view generating task 201B are not described in detail here.

[0182] S709, scene recognition.

[0183] It is understandable that the scenario of updating the current interface view can be further identified based on the user's operation on the page. For example, the chat list sliding view update scenario (for example Figure 1A Example of sliding up to update chat history), chat page switching view update scenario (for example Figure 1B The example chat page turning scene) etc. Then it is convenient to perform step S710 below to detect that the view changes.

[0184] S710: A change in the list item view is detected.

[0185] Here, you can determine whether the list item view has changed by detecting whether the attribute elements of the list item view have changed, for example Figure 2C The case where the view type of the example changes.

[0186] S711, using the completion of the switching operation by the user as an indication, pulling up the asynchronous task preloading view.

[0187] It can be understood that by using the end of the user operation as a marker to execute the preloading of the view, the preloading of the view array can be started before entering the interface drawing process, such as starting the preloading thread, which speeds up the loading process of the interface view layer.

[0188] S712, the asynchronous task preloads the list item view.

[0189] It can be understood that the specific implementation process of the above step S712 can refer to the specific implementation process of the above step S505, which will not be repeated here.

[0190] S713, asynchronous task background updates view.

[0191] It can be understood that the specific implementation process of the above step S713 can refer to the specific implementation process of the above step S506, which will not be repeated here.

[0192] S714, complete the reuse of view components.

[0193] For example, reference Fig. 8A In some implementations, the process of view generation and the process of loading the view array are executed synchronously, resulting in repeated loading of views during the view generation process (e.g. Figure 2A The view generation steps 021, 022 and 023 of the example cause the interface loading time to be too long.

[0194] Understandably, Fig. 8A The execution subject of each step of the process shown can be the mobile phone 00 mentioned above, or other electronic devices, and the execution subject of a single step will not be described in detail. The specific process is as follows:

[0195] 080, start a known activity (that is, an activity stored in the preset view object library).

[0196] 081, check whether the view in the activity has changed, if it has changed, execute step 082, load the new view. If it has not changed, execute 083, grab the loaded view.

[0197] 082, load a new view.

[0198] 083, grab the loaded view.

[0199] In this application, reference is made to Figure 8B In some implementations, the view generation process and the view array loading process are divided into two threads for asynchronous execution, that is, the view is preloaded, and then the view generation process directly accesses the preset view object library to obtain the preloaded list item view (for example Figure 3B Example preloading task 201A and view generation task 201B).

[0200] Understandably, Figure 8B The execution subject of each step of the process shown can be the electronic device 100 described above, or other electronic devices, and the execution subject of a single step will not be described in detail. The specific process is as follows:

[0201] S801, start a known activity.

[0202] It can be understood that the specific implementation of the above step S801 can refer to the above step S501, which will not be repeated here.

[0203] S802: Update the known view.

[0204] It can be understood that the specific implementation of the above step S802 can refer to the above steps S504 to S506, which will not be described in detail here.

[0205] S803, confirm the scene.

[0206] It can be understood that the specific implementation of the above step S803 can refer to the above step S709, which will not be repeated here.

[0207] S804, grab the loaded view.

[0208] It can be understood that the specific implementation of the above step S804 can refer to the above step S509, which will not be repeated here.

[0209] It can be understood that the above steps S801 and S804 can be executed by the view generation thread, while S802 and S803 can be executed by the preloading thread, and the view generation thread and the preloading thread can be executed asynchronously. Therefore, after the user switches to the first interface, the view object corresponding to the list item view can be preloaded before the view is generated. In the process of the main thread drawing the first view layer of each frame of the first interface, the inflate function is no longer called to load the view or load the resource file, which effectively shortens the interface loading time.

[0210] Combine the following 9A to 10C The effect of reducing the interface loading time in the embodiment of the present application is described in detail.

[0211] refer to 9A to 9D , both show the application Fig. 8A The following is a test time diagram of calling the doFrame function to draw the interface frame in an example manner.

[0212] Fig.9A A schematic diagram showing the time taken to load an interface when entering the interface for the first time is shown.

[0213] refer to Fig.9A The inflate function is called repeatedly in the measurement and layout process, resulting in a total time of 458 milliseconds (ms) to draw the first frame and the first interface.

[0214] Fig. 9B A schematic diagram showing the layout time when entering the interface for the first time.

[0215] refer to Fig. 9B The inflate function is called repeatedly in the layout process, resulting in a layout time of 108.4 milliseconds in the process of drawing the first frame and the first interface.

[0216] and Fig. 9C and Fig.9D The figure shows the time taken to call the onLayout function to calculate the view layout in the case of a large number of views using the method shown in FIG8 . Fig. 9C , the first layout process takes up to 132 milliseconds. Fig.9D ,The second layout processing takes up to 95.7 milliseconds.

[0217] And reference FIG. 10A to FIG. 10C , all show the application of the embodiment of the present application Figure 8B The following is a test time diagram of calling the doFrame function to draw the interface frame in an example manner.

[0218] Fig. 10A According to an embodiment of the present application, a schematic diagram of the time taken to load an interface when entering the interface for the first time is shown.

[0219] refer to Fig. 10A , the measurement process and layout process do not call the inflate function, and the total time for drawing the first frame and the first interface is from Fig.9A The 458 milliseconds were shortened to 64.7 milliseconds.

[0220] Fig. 10B According to an embodiment of the present application, a schematic diagram of layout processing timing when entering an interface for the first time is shown.

[0221] refer to Fig. 10B Shown Fig. 10A The calculation time of the layout process in the layout process is not called in the inflate function, and the layout processing time is from Fig.9A The 108.4 milliseconds shown are shortened to 22.1 milliseconds.

[0222] Fig. 10C According to an embodiment of the present application, a schematic diagram of the interface loading time of a secondary entry interface is shown.

[0223] refer to Fig. 10C , Second entry Fig. 10A When drawing the same interface, the overall time for drawing each frame of the interface is shortened to 9.3 milliseconds.

[0224] It can be seen that, through steps S801 to S804 of the embodiment of the present application, the present application preloads the view objects in the first interface corresponding to the activity in the preloading thread, avoiding repeatedly calling the inflate function to load views or resource files in the view generation thread, which can effectively shorten the interface loading time. In addition, the application of the preset view object library prevents the stored loaded views from being overwritten, thereby significantly shortening the time to enter the same interface for the second time.

[0225] Combine the following Fig.11 The hardware structure of an electronic device according to an embodiment of the present application is described in detail.

[0226] Fig.11 According to an embodiment of the present application, a hardware structure diagram of an electronic device 100 is shown.

[0227] like Fig.11As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0228] It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine certain components, or separate certain components, or arrange the components differently, which is not limited here.

[0229] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, etc. Among them, different processing units may be independent devices or integrated into one or more processors.

[0230] In some embodiments, the controller generates an operation control signal based on the instruction operation code and timing signal of the processor 110 to complete the control of instruction fetching and instruction execution to execute the interface loading method provided in the embodiments of the present application.

[0231] In some embodiments, the processor 110 may include one or more interfaces. In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. Among them, the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices.

[0232] In some embodiments, the processor 110 may include multiple I2C bus interfaces. The processor 110 may be coupled to the acceleration sensor 180E, the charger, the flash, the camera 193, etc. through different I2C bus interfaces.

[0233] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. In some embodiments of the present application, the loaded view array may be cached in the memory of the processor 110.

[0234] In some embodiments, the processor 110 may include one or more interfaces. The interface may include a universal serial bus (USB) interface, etc. Among them, the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device.

[0235] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.

[0236] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0237] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.

[0238] The mobile communication module 150 may provide solutions for wireless communications including 2G / 3G / 4G / 5G etc. applied to the electronic device 100. The modem processor may include a modulator and a demodulator.

[0239] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0240] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0241] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.

[0242] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-LED, Micro-OLED, quantum dot light-emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0243] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0244] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo or shooting a video, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0245] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0246] Video codecs are used to compress or decompress digital video.

[0247] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .

[0248] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the data storage area can store data created during the use of the electronic device 100 (such as video data obtained by shooting, etc.). In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, etc. The processor 110 executes various functional applications and interface loading of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0249] In some embodiments, the internal memory 121 may store a historical view library to store historically loaded view components.

[0250] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0251] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .

[0252] There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. Capacitive pressure sensors can be at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.

[0253] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .

[0254] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0255] The magnetic sensor 180D includes a Hall sensor, and the electronic device 100 can detect the opening and closing of the flip leather case by using the magnetic sensor 180D.

[0256] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0257] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser.

[0258] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector.

[0259] The ambient light sensor 180L is used to sense the brightness of ambient light.

[0260] The fingerprint sensor 180H is used to collect fingerprints.

[0261] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection.

[0262] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194.

[0263] References to "one embodiment" or "an embodiment" in the specification mean that the specific features, structures, or characteristics described in conjunction with the embodiment are included in at least one exemplary implementation or technology disclosed according to the embodiment of the present application. The appearance of the phrase "in one embodiment" in various places in the specification does not necessarily all refer to the same embodiment.

[0264] The disclosure of the embodiment of the present application also relates to an operating device for executing the text. The device can be specially constructed for the required purpose or it can include a general-purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program can be stored in a computer-readable medium, such as, but not limited to any type of disk, including a floppy disk, an optical disk, a CD-ROM, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an EPROM, an EEPROM, a magnetic or optical card, an application-specific integrated circuit (ASIC) or any type of medium suitable for storing electronic instructions, and each can be coupled to a computer system bus. In addition, the computer mentioned in the specification may include a single processor or may be an architecture involving multiple processors for increased computing power.

[0265] In addition, the language used in this specification has been primarily selected for readability and instructional purposes and may not be selected to describe or limit the disclosed subject matter. Therefore, the present application embodiment disclosure is intended to illustrate rather than limit the scope of the concepts discussed herein.

Claims

1. An interface loading method, applied to an electronic device, characterized in that: include: Displaying a first display interface, wherein the first display interface includes first display content corresponding to a first list item view of a first list view; A first switching operation to switch to a second display interface is detected, where the second display interface includes second display content corresponding to a second list item view of a second list view; Determine a first view object corresponding to the second list item view of the second list view stored in the electronic device; The second display interface is generated based on the stored first view object.

2. The method according to claim 1, characterized in that The method for acquiring the first view object corresponding to the second list item view of the stored second list view includes: It is determined that the electronic device does not store the first view object, and the first view object is generated and stored.

3. The method according to claim 2, characterized in that The first view object will not be deleted within a first time threshold.

4. The method according to claim 2, characterized in that: The determining the first view object corresponding to the second list item view of the second list view stored in the electronic device includes: A first view object corresponding to the second list item view of the second list view stored in the electronic device is determined by using a first thread, wherein the first thread is established when an application corresponding to the second display interface is started.

5. The method according to claim 4, characterized in that The determining that the electronic device does not store the first view object, and generating and storing the first view object includes: Determining, by using the first thread, that the electronic device does not store the first view object; The first view object is generated and stored using the first thread according to the resource file corresponding to the second list item view.

6. The method according to claim 1, characterized in that Generating the second display interface based on the stored first view object includes: After the first switching operation is completed, establishing a second thread; The second display interface is generated based on the stored first view object by using the second thread.

7. The method according to claim 2, characterized in that: The storing the first view object comprises: Determining a first activity corresponding to the second display interface; The first view object is stored in a view object collection corresponding to the first activity.

8. The method according to claim 2, characterized in that: The storing the first view object comprises: The first view object is stored in a key-value database or a global variable.

9. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more instructions, and when the one or more instructions are executed by the one or more processors, the electronic device executes the interface loading method described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The storage medium stores instructions, which, when executed on a computer, enable the computer to execute the interface loading method according to any one of claims 1 to 8.