Embodiment
The embodiment of the present application provides loading method, device and the application of page data in a kind of mobile terminal.
In order that those skilled in the art more fully understand the technical scheme in the application, it is real below in conjunction with the application
The accompanying drawing in example is applied, the technical scheme in the embodiment of the present application is clearly and completely described, it is clear that described implementation
Example only some embodiments of the present application, rather than whole embodiments.It is common based on the embodiment in the application, this area
The every other embodiment that technical staff is obtained under the premise of creative work is not made, it should all belong to the application protection
Scope.
Fig. 1 is the schematic diagram of a scenario of the application one embodiment page data loading.In the embodiment shown in fig. 1, stock
Class application needs to load the contents such as stock index market, timesharing/day K information and important news.
For ease of understanding the division of each module in application, Fig. 2 shows the scene of the page data loading through Module Division
Schematic diagram.Wherein, Part1 parts are the related service module of stock index market, and Part2 parts are the related service module of K line charts,
Part3 parts are the related service module of important news.
In the page loading method of existing terminal applies, typically in page open, each module in the page
Service data request individually is sent, further according to the data render current page of return.
The method of available data, if the current page type of application is relatively more, content of pages is long, in some low sides
The record that type occur during the page loading OOM is very big, and it is very high to move back the probability of (Crash) using sudden strain of a muscle, and this feelings occurs
The cost repaired after condition is also higher.
Page data loading method, device and the application of the application can solve the problem that above mentioned problem.
Fig. 3 is the method flow diagram of one embodiment page data loading of the application.Fig. 3 method is added by page data
Carry and put execution.Specifically, the page data loading device can be the One function module of terminal applies.Fig. 3 method can
Including:
S301, according to the business module in the page to be shown in application, in the ExpandableListview of the page
The group head of packet corresponding to each business module is added in object.
It should be understood that ExpandableListView is a kind of special Listview with group concept, it is ListView
Subclass, extended on the basis of Listview.ExpandableListView objects are a kind of with to list items
The list display object of the function of grouping management is carried out, the list items in application can be grouped, if each packet includes
Dry list items.In ExpandableListView objects, it typically may include two-layer node, i.e. packet node, and packet
The subitem node of node.It should be understood, of course, that in ExpandableListView objects, can there is no subitem under packet node
Node, but subitem node necessarily belongs to some packet node.
It should be understood that when drawing ExpandableListView, it is necessary first to set for ExpandableListView objects
Put adapter (Adapter).Adapter is set to ExpandableListView, then data source must be first set;Data
Source can use adapter class ExpandableAdapter, and such inherits BaseExpandableListAdapter, is
An ExpandableListView subclass., it is necessary to rewrite multiple methods of the inside in specific application, for example, rewriteeing
GetChildView () and getGroupView () method set customized layout;When data source is set, pass through calling
Contractile function can be achieved in the setAdapter () of ExpandableListView objects.It should be understood that pair
The addition of/subpackets item in ExpandableListview objects, actually to ExpandableListview objects institute
The addition of/subpackets item in the Adapter of binding.
By taking the scene shown in Fig. 2 as an example, Part1 parts are added in ExpandableListview objects using needs
The group head of packet corresponding to stock index market business module, the group head of packet corresponding to the K line charts business module of Part2 parts, with
And the group head of packet corresponding to the important news business module of Part3 parts.Wherein, the K line chart business modules of Part2 parts, including
Timesharing K line charts business module, day K line chart business module, all K line charts business modules and moon K line chart business module etc..Specific
In realization, the page data loading device of application or application can be in the Adapter bound in ExpandableListview objects
It is grouped corresponding to middle each business module of addition.
S302, send business datum corresponding to each first kind business module in the page to the service server of application respectively
Request.
Wherein, the first kind business module is that the business module in the displaying of page open stage is needed in the page.Ying Li
Solution, shown in the page open stage, refer to after the page is initially opened, shown in the screen of mobile terminal.
Or by taking the scene shown in Fig. 2 as an example, stock index market business module, and the timesharing K line chart business moulds in K line charts
Block in the page open stage, it is necessary to show.That is, the first kind business module includes stock index market business module, and
Timesharing K line chart business modules.Therefore, in the embodiment of the present application, in the page open stage, using needing to ask stock index market industry
The business datum for module of being engaged in, and the business datum of timesharing K line chart business modules.
S303, by the business datum of each first kind business module of feedback, respectively as the ExpandableListview
The subitem addition of packet corresponding to each first kind business module in object, and deploy to show and divide corresponding to each first kind business module
Group.
Or by taking the scene shown in Fig. 2 as an example.The business datum of stock index market business module is being added to stock index market
The subitem of packet corresponding to business module, and the business datum of timesharing K line chart business modules is added to timesharing K line chart business moulds
It is grouped after the subitem of packet corresponding to block, it is necessary to deploy to show corresponding to stock index market business module, and timesharing/day K information
It is grouped corresponding to business module.In concrete implementation, the page data loading device of application or application can be
The subitem of packet corresponding to stock index market business module is added in Adapter bound in ExpandableListview objects,
And the subitem of packet corresponding to timesharing K line charts business module.
In the embodiment of the present application, data are loaded by using ExpandableListview components, and add in page data
During load, the only service server request to application needs the business datum of the packet shown, the general of OOM occurs so as to reduce
Rate, provide the user more preferable experience.
It should be understood that the embodiment of the present application uses ExpandableListView objects as list display object, but also not
Exclude to show that the Listview objects of function substitute the embodiment of the present application with two-layer node display structure and packet with other
The mode of ExpandableListView objects, its alternative fall within the content that the embodiment of the present application is protected.
It should be understood, of course, that in the embodiment of the present application, if packet corresponding to business module is not in mobile terminal in the page
Display screen in, then the group head of the business module will not be drawn, but the group head data of the business module have been present
In with the Adapter bound in ExpandableListView.
For example, in the embodiment depicted in figure 2, group head can't be painted in page open corresponding to important news business module
System, only when corresponding to important news business module organize head enter mobile terminal screen in, just can be to corresponding to important news business module
Group head is drawn.
It should be understood, of course, that in the embodiment of the present application, application or page data loading device can also according to being actually needed,
Increase gauge outfit, or position of the adjustment gauge outfit in ExpandableListview objects in ExpandableListview objects
Put, the embodiment of the present application is not restricted to this.
Alternatively, also include as one embodiment, this method:
When packet deploys for the first time corresponding to the second class business module, second class is sent to the service server of application
Service data request corresponding to business module, wherein, the second class business module is that need not be shown in the page open stage
Business module;
By the business datum of the second class business module of feedback, as this in the ExpandableListview objects
The subitem addition of packet corresponding to two class business modules, and deploy to show and be grouped corresponding to the second class business module.
In the embodiment of the present application, the requested service data, and be added to this again when the second class business module deploys for the first time
It is grouped in ExpandableListview objects corresponding to the second class business module, to be shown, so as to avoid page
Face disposably loads too many business datum, and then reduces the probability that OOM occurs.
Or by taking the scene shown in Fig. 2 as an example, in the scene shown in Fig. 2, important news business module is the second class business mould
Block.The application of stock class can be when important news business module deploys for the first time, and the service server applied to stock class sends important news industry
Service data request corresponding to module of being engaged in, to ask business datum corresponding to stock market's important news.Fed back when receiving service server
Business datum after, stock class application can be using the business datum of important news business module as being grouped corresponding to important news business module
Subitem adds, and then expansion shows and is grouped corresponding to important news business module.
Alternatively, as one embodiment, when scrolling the subitem being grouped corresponding to business module, this method may be used also
Including:
By remove subitem display View target caches to recovery the application where operating system recycler
In Recycler, the removal subitem is the son for removing screen viewing angle in the ExpandableListview objects from dispaly state
;
The View objects are reused as the convertView parameters in the getView for moving into item calling, to complete the immigration
The drafting of the view objects of subitem, the immigration subitem are the son that screen viewing angle is moved into the ExpandableListview objects
.
Fig. 4 shows a kind of method for scrolling the subitem of packet corresponding to business module of one embodiment of the application
Schematic diagram.As shown in figure 4, no matter the business module of current ExpandableListview objects includes how many individual subitems
(item), mobile terminal only needs wherein visible View objects being stored in internal memory.When slide downward, top is invisible
Item1 move directly in recycler Recycler, the application of stock class is taken out from Recycler again Item1 and fills out again
Make up the number evidence, then move to lower section and be changed into new new-added item Item8.
Here is one section of concrete implementation code:
In the embodiment of the present application, the subitem object of display screen is removed by using Recycler circulation and stress, then is passed through
Fill data and form the subitem for moving into display screen, so as to less object implementatio8 ExpandableListview objects
The display of middle subitem, avoid, because business datum results in the need for creating excessive subitem object too much, to a certain extent also can
Reduce the probability for OOM occur.
Alternatively, also include as one embodiment, this method:
When drawing the first subitem for the first time, the display content of the view objects of first subitem is set and arrives the View objects
Specified attribute in, first subitem is the subitem in any one group in the ExpandableListview objects;
When drawing first subitem again, first son is loaded from the specified attribute of the view objects of first subitem
The display content of the view objects of item simultaneously completes the drafting of the view objects of first subitem.
Alternatively, the specified attribute can be the tag attributes of view objects, or other attributes.
Here is one section of concrete implementation code, with the display content of the tag property cache subitems of view objects:
In the embodiment of the present application, by the way that category of the content caching to the View objects of subitem will be shown when drawing subitem for the first time
Property in so that application or page data loading device can be directly from the View objects of the subitem when drawing the subitem again
Displaying content is obtained in attribute, substantially increases the efficiency that subitem is drawn again.
Alternatively, also include as one embodiment, this method:If subsequently the page loaded is needed to include this
The content that ExpandableListview objects are shown, then it is the ExpandableListview objects is follow-up directly as this
Need the object in the page that loads.
In the embodiment of the present application, if needing to show current ExpandableListview in the page for subsequently needing to load
The content that object is shown, directly the ExpandableListview objects can be delivered in the page subsequently opened, so as to
Without carrying out the establishment of ExpandableListview objects and the operation of requested service data again, follow-up needs are substantially increased
The opening efficiency of the page of loading.
Alternatively, as one embodiment, each business mould is added in the ExpandableListview objects of the page
The group head of packet corresponding to block, specifically can be achieved be:
When the group head being grouped corresponding to the first business module in the ExpandableListview objects does not need display name
During title, it is added to the ExpandableListview objects using Transparent thin line as the group head being grouped corresponding to the first business module
In.
Or by taking the scene shown in Fig. 2 as an example, stock index market business module need not show title, now, can incite somebody to action
Group head of piece Transparent thin line as packet corresponding to stock index market business module.
In the embodiment of the present application, by regarding Transparent thin line as group head so that the page need not show unwanted user's letter
Breath, so as to simplify the page, make the display of the page more succinct.
Optionally, as one embodiment, S303 specifically can be achieved be:If in the ExpandableListview objects
The quantity for the business datum that service data request corresponding to first kind business module is asked exists more than the first kind business module
The number for the subitem that can be shown in screen, then only add the first kind business in packet corresponding to the first kind business module
The subitem that module can be shown in screen.
By taking Fig. 4 as an example, it is assumed that some business module can only show 7 business datums, the industry in the screen of mobile terminal
The current business datum of business module has 8, then application or page data loading device only need to draw corresponding to 7 business datums
7 subitems.
Further, step S303 may also include:Drawn in packet corresponding to the first kind business module for showing
The function button of more business data.
It is again assumed that some business module can only show 7 business datums, the business module in the screen of mobile terminal
Current business datum has 8.After 7 subitems corresponding to 7 business datums are drawn, application or page data loading device are also
Can in packet corresponding to the business module displaying " check more " button, when user clicks on " checking more ", using or
Page data loading device can install subitem corresponding to display more business data additional.Certainly, if the current industry of the business module
Data of being engaged in are less than or equal to 7, and application or page data loading device can show the button of " temporarily without more ", or not show additionally
Show button, etc..
Optionally, as one embodiment, S303 specifically can be achieved be:If in the ExpandableListview objects
The quantity for the business datum that service data request corresponding to first kind business module is asked exists more than the first kind business module
The number for the subitem that can be shown in screen, then add the first kind industry in packet corresponding to the first kind business module
The subitem of all business datums corresponding to module of being engaged in, and only draw the son that the first kind business module can be shown in screen
.
It is again assumed that some business module can only show 7 business datums, the business module in the screen of mobile terminal
Current business datum has 8.Using or page data loading device can in the ExpandableListview objects industry
8 subitems of packet addition corresponding to module of being engaged in, but only draw 7 subitems and shown.
It should be understood, of course, that using or page data loading device when sending service data request, can use paging load
Etc. mode request data.For example, 8 business datums are at most asked every time, or business datum of other quantity, etc..
Alternatively, in the embodiment of the present application, the application may include that the page loading such as stock class application exceedes certain data
The application of the business datum of amount.
Fig. 5 is the structural representation of one embodiment electronic equipment of the application.Fig. 5 is refer to, in hardware view, the electricity
Sub- equipment includes processor, alternatively also includes internal bus, network interface, memory.Wherein, memory may include interior
Deposit, such as high-speed random access memory (Random-Access Memory, RAM), it is also possible to also including non-volatile memories
Device (non-volatile memory), for example, at least 1 magnetic disk storage etc..Certainly, the electronic equipment is also possible that other
Hardware required for business.
Processor, network interface and memory can be connected with each other by internal bus, and the internal bus can be ISA
(Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral
Component Interconnect, Peripheral Component Interconnect standard) bus or EISA (Extended Industry Standard
Architecture, EISA) bus etc..The bus can be divided into address bus, data/address bus, control always
Line etc..For ease of representing, only represented in Fig. 5 with a four-headed arrow, it is not intended that an only bus or a type of
Bus.
Memory, for depositing program.Specifically, program can include program code, and described program code includes calculating
Machine operational order.Memory can include internal memory and nonvolatile memory, and provide instruction and data to processor.
Processor read from nonvolatile memory corresponding to computer program into internal memory then run, in logical layer
Page data loading device is formed on face.Processor, the program that memory is deposited is performed, and specifically for performing following grasp
Make:
Processor;And
It is arranged to store the memory of computer executable instructions, the executable instruction makes the processor when executed
Perform following operate:
According to the business module in the page to be shown in application, in the ExpandableListview objects of the page
Add the group head of packet corresponding to each business module;
Service data request corresponding to each first kind business module in the page is sent to the service server of application respectively,
Wherein, the first kind business module is that the business module in the displaying of page open stage is needed in the page;
By the business datum of each first kind business module of feedback, respectively as in the ExpandableListview objects
The subitem addition of packet corresponding to each first kind business module, and deploy to show and be grouped corresponding to each first kind business module.
The method that application or page data loading device disclosed in the above-mentioned embodiment illustrated in fig. 3 such as the application perform can answer
Realized in processor, or by processor.Processor is probably a kind of IC chip, has the processing energy of signal
Power.In implementation process, each step of the above method can pass through the integrated logic circuit or software of the hardware in processor
The instruction of form is completed.Above-mentioned processor can be general processor, including central processing unit (Central Processing
Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital
Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit,
ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other FPGAs
Device, discrete gate or transistor logic, discrete hardware components.It can realize or perform the public affairs in the embodiment of the present application
Each method, step and the logic diagram opened.General processor can be microprocessor or the processor can also be it is any often
Processor of rule etc..The step of method with reference to disclosed in the embodiment of the present application, can be embodied directly in hardware decoding processor and hold
Row is completed, or performs completion with the hardware in decoding processor and software module combination.Software module can be located at deposits at random
Reservoir, flash memory, read-only storage, this area such as programmable read only memory or electrically erasable programmable memory, register
In ripe storage medium.The storage medium is located at memory, and processor reads the information in memory, is completed with reference to its hardware
The step of above method.
In the embodiment of the present application, electronic equipment loads data by using ExpandableListview components, and in page
During the data loading of face, the only service server request to application needs the business datum of the packet shown, so as to reduce out
Existing OOM probability, provides the user more preferable experience.
The electronic equipment can also carry out Fig. 3 method, and realize work(of the page data loading device in embodiment illustrated in fig. 3
Can, the embodiment of the present application will not be repeated here.
Certainly, in addition to software realization mode, the electronic equipment of the application is not precluded from other implementations, for example patrols
Collect mode of device or software and hardware combining etc., that is to say, that the executive agent of following handling process is not limited to each patrol
Collect unit or hardware or logical device.
The embodiment of the present application also proposed a kind of computer-readable recording medium, the computer-readable recording medium storage one
Individual or multiple programs, one or more programs include instruction, and the instruction is when the portable electronic for being included multiple application programs
When equipment performs, the method for the portable electric appts execution figure X illustrated embodiments can be made.
Fig. 6 is the structural representation of one embodiment page data loading device 600 of the application.Fig. 6 is refer to, one
In kind Software Implementation, page data loading device 600 may include:It is grouped adding device 610, request of data unit 620, son
Item adding device 630 and display unit 640, wherein
Adding device 610 is grouped, according to the business module in the page to be shown in application, in the page
The group head of packet corresponding to each business module is added in ExpandableListview objects;
Request of data unit 620, send each first kind business module pair in the page to the service server of application respectively
The service data request answered, wherein, the first kind business module is that the business in the displaying of page open stage is needed in the page
Module;
Subitem adding device 630, by the business datum of each first kind business module of feedback, respectively as this
The subitem addition of packet corresponding to each first kind business module in ExpandableListview objects;
Display unit 640, expansion show and are grouped corresponding to each first kind business module.
In the embodiment of the present application, page data loading device 600 loads by using ExpandableListview components
Data, and when page data loads, the only service server request to application needs the business datum of the packet shown, so as to
The probability for OOM occur can be reduced, provides the user more preferable experience.
Alternatively, also it is being grouped first corresponding to the second class business module as one embodiment, request of data unit 620
During secondary expansion, service data request corresponding to the second class business module is sent to the service server of application, wherein, this second
Class business module is the business module that need not be shown in the page in the page open stage;
Subitem adding device 630 also by the business datum of the second class business module of feedback, is used as this
The subitem addition of packet corresponding to the second class business module in ExpandableListview objects;
Display unit 640 also deploys to show to be grouped corresponding to the second class business module.
Further, display unit 640 will remove subitem also when scrolling the subitem being grouped corresponding to business module
Display View target caches to reclaim the application where operating system recycler Recycler in, the removal subitem
For the subitem of screen viewing angle is removed in the ExpandableListview objects from dispaly state;The View objects are reused as shifting
Enter the convertView parameters in the getView of item calling, to complete the drafting of the view objects of the immigration subitem, the immigration
Subitem is the subitem that screen viewing angle is moved into the ExpandableListview objects.
Further, display unit 640 also when drawing the first subitem for the first time, by the aobvious of the view objects of first subitem
Show curriculum offering into the specified attribute of the View objects, first subitem is any in the ExpandableListview objects
Subitem in one group;When drawing first subitem again, loaded from the specified attribute of the view objects of first subitem
The display content of the view objects of first subitem and the drafting for completing the view objects of first subitem.
Alternatively, as one embodiment, if subsequently needing the page loaded to include this
The content that ExpandableListview objects are shown, then display unit 640 can be by the ExpandableListview objects
Directly as the object in the follow-up page for needing to load.
Alternatively, it is specifically used for as one embodiment, packet adding device 610:As the ExpandableListview
When the group head of packet corresponding to the first business module does not need display Name in object, using Transparent thin line as the first business module
The group head of corresponding packet is added in the ExpandableListview objects.
Alternatively, as one embodiment, if first kind business module pair in the ExpandableListview objects
The quantity for the business datum that the service data request answered is asked is more than what the first kind business module can be shown in screen
The number of subitem, then subitem adding device 630 only corresponding to the first kind business module packet in add the first kind business
The subitem that module can be shown in screen.
Further, in this example it is shown that unit 640 is also drawn in packet corresponding to the first kind business module
For showing the function button of more business data.
Page data loading device 600 can also carry out applied in embodiment illustrated in fig. 3 or page data loading device perform
Method, the embodiment of the present application will not be repeated here.
The embodiment of the present application additionally provides a kind of application, and the application includes electronic equipment in embodiment illustrated in fig. 5 and stored
Page data loading device, or including page data loading device in embodiment illustrated in fig. 6.
The embodiment of the present application additionally provides a kind of computer-readable recording medium, the computer-readable recording medium storage one
Individual or multiple programs, one or more programs include instruction, and the instruction is held when the electronic equipment for being included multiple application programs
During row so that the electronic equipment performs following operate:
According to the business module in the page to be shown in application, in the ExpandableListview objects of the page
Add the group head of packet corresponding to each business module;
Service data request corresponding to each first kind business module in the page is sent to the service server of application respectively,
Wherein, the first kind business module is that the business module in the displaying of page open stage is needed in the page;
By the business datum of each first kind business module of feedback, respectively as in the ExpandableListview objects
The subitem addition of packet corresponding to each first kind business module, and deploy to show and be grouped corresponding to each first kind business module.
Alternatively, in the embodiment of the present application, the application may include that the page loading such as stock class application exceedes certain data
The application of the business datum of amount.
In a word, the preferred embodiment of the application is the foregoing is only, is not intended to limit the protection domain of the application.
All any modification, equivalent substitution and improvements within spirit herein and principle, made etc., should be included in the application's
Within protection domain.
System, device, module or the unit that above-described embodiment illustrates, it can specifically be realized by computer chip or entity,
Or realized by the product with certain function.One kind typically realizes that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media play
It is any in device, navigation equipment, electronic mail equipment, game console, tablet PC, wearable device or these equipment
The combination of equipment.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moved
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Define, calculate according to herein
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of elements not only include those key elements, but also wrapping
Include the other element being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Other identical element also be present in the process of element, method, commodity or equipment.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for system
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.