Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment

A technology for asynchronous data and loading devices, applied in the direction of program control devices, program loading/starting, etc., can solve problems such as memory overflow, achieve the effect of preventing OOM problems and protecting CPU overhead

Inactive Publication Date: 2013-12-18
南京朗睿软件科技有限公司
View PDF2 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] The problem to be solved by the embodiment of the present invention is that when the view adapter of the Android device performs asynchronous data loading, the problem of memory overflow is prone to occur

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment
  • Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment
  • Android equipment, and asynchronous data uploading method and device for AdapterView of Android equipment

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0041] 本实施例提供了一种安卓设备的适配器视图异步数据加载方法,参考 figure 1 ,以下通过具体步骤进行详细说明:

[0042] 步骤S101,适配器视图单元接收到操作指令,向通用适配器单元的获取视图子单元发送调用请求。

[0043]In a specific implementation, the adapter view unit may be AdapterView, the general adapter unit may be GenericAdapter, and the view subunit may be obtained by a getView function. The operation instructions received by the AdapterView can be divided into two types: sliding the AdapterView or sliding the focus to control the AdapterView. AdapterView calls the getView function of GenericAdapter according to the received operation instruction.

[0044] Step S102, the acquiring view subunit creates a thread for loading asynchronous data according to the received call request, and triggers the asynchronous data management unit.

[0045] In a specific implementation, the asynchronous data management class unit may be the AsyncDataManager class. The getView function is called every time an item in the list data is detected. The getView function creates a ...

Embodiment 2

[0053] This embodiment provides an asynchronous data loading method for the adapter view of an Android device, refer to figure 2 , the following are detailed steps through specific steps:

[0054] In step S201, the AdapterView receives a sliding operation command and calls the getView function of the GenericAdapter.

[0055] In a specific implementation, the operation instructions received by the AdapterView can be divided into two types: sliding the AdapterView or sliding the focus to control the AdapterView. AdapterView calls the getView function of GenericAdapter according to the received operation instruction.

[0056] Step S202, the getView function creates a thread for loading asynchronous data, and triggers the AsyncDataManager class periodically.

[0057] In a specific implementation, the getView function may receive multiple call requests within a timing period. According to the call request, the getView function creates a corresponding thread for loading asynchro...

Embodiment 3

[0074] This embodiment provides an adapter view asynchronous data loading device for an Android device, refer to image 3 , the asynchronous data loading device includes: an adapter view unit 301, a general adapter unit 302, an asynchronous data management unit 303, and an execution task unit 304, wherein:

[0075] The adapter view unit 301 is configured to send a call request to the acquisition view subunit 3021 of the general adapter unit 302 when receiving the operation instruction;

[0076] The universal adapter unit 302 includes an acquisition view subunit 3021, and the acquisition view subunit 3021 is used to create a thread for loading asynchronous data and trigger the asynchronous data management unit 303 according to the received call request;

[0077] The asynchronous data management unit 303 includes a push task subunit 3031, and the push task subunit 3031 is used to push the thread for loading asynchronous data into a thread pool, when the number of threads in the ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses Android equipment, and an asynchronous data uploading method and device for AdapterView of the Android equipment. The asynchronous data uploading method for the AdapterView comprises the steps that an AdapterView unit receives an operation instruction, and sends a calling request to a getView subunit of a GenericAdapter unit; the getView subunit creates a thread for uploading asynchronous data according to the received calling request, and triggers an AsyncDataManager unit; a PushTask subunit of the AsyncDataManager unit pushes the thread for uploading the asynchronous data to a thread pool, wherein when the number of threads in the thread pool reaches a preset threshold value, the PushTask subunit is used for performing sequencing and waiting on threads which are newly created by the getView subunit; and an ExecuteTask unit calls the threads in the thread pool and uploads the asynchronous data. By adopting the method, the device and the Android equipment, the CPU overhead of a system can be effectively protected, and an overflow problem of an internal memory can be prevented.

Description

technical field [0001] 本发明涉及安卓设备领域,特别涉及一种安卓设备及其适配器视图的异步数据加载方法及装置。 Background technique [0002] 随着无线通信技术的飞速发展,基于安卓(Android)操作系统的手机越来越普及,使得越来越多的软件开发者转向到Android手机软件领域的开发。在Android系统开发中,几乎每个应用都会涉及到视图适配器(AdapterView)的异步数据加载。 [0003] AdapterView是Android系统中的类,可以包括列表视图(ListView)、网格视图(GridView)和画廊(Gallery)等视图方式。现有的一种异步数据加载方法是通过监测ListView的滑动事件进行异步数据加载,或者通过监测GridView的滑动事件进行异步数据加载。由于不同视图方式的异步数据加载机制不同,只能对单一种类的视图进行加载,不能实现通用,因此需要一个能够通用的异步数据加载方案。 [0004] 为实现通用的异步数据加载,现有技术提供了一种通过触发通用适配器(GenericAdapter)获取视图并创建线程进行异步数据加载的方法。例如,当检测到屏幕滑动时,AdapterView会触发GenericAdapter中的获取视图(getView)函数,每检测到滑过列表数据中的一个项(item)都调用一次getView函数,创建一个线程去加载异步数据,并将加载完成的数据渲染到屏幕上。 [0005] 然而,当屏幕滑动速度较快时,由于每滑过一个item会调用一次getView函数,系统会创建出很多线程,导致同一时间内存在的线程过多,内存不够,出现内存溢出(Out Of Memory,OOM)。 [0006] 因此,一种能够避免内存溢出的异步数据加载方案成为迫切的需求。 Contents of the invention [0007] 本发明实施例要解决的问题是安卓设备的视图适配器进行异步数据加载时,容易出现内存溢出的问题。 [0008] 为解决上述问题,本发明实施例提供一种安卓设备的适配器视图异步数据加载方法,包括:适配器视图单元接收到操作指令,向通用适配器单元的获取视图子单元发送调用请求;所述获取视图子单元根据接收到的调用请求,创建加载异步数据的...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/445
Inventor 莫文飞吴春雷张文东田路
Owner 南京朗睿软件科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products