当前位置:网站首页>General operations of asynctask
General operations of asynctask
2022-06-26 03:36:00 【kingsley1212】
AsyncTask It's a lightweight asynchronous task class , It can always perform background tasks in the thread pool , Then the execution progress and final results are passed to the main thread and are always updated in the main thread UI
2) Inherit AsyncTask Functions that can be implemented
- onPreExecute():( Running on the UI In the thread ) ( Non essential method , You don't have to implement )
Called before the task is executed by the thread pool , Usually used to do some preparatory operations , For example, before the download file task is executed , Display a progress bar in this method .
2.doInBackground(Params… params):( Running in child threads )( This function is an abstract function and must be implemented )
Called when the task is executed by the thread pool , Time consuming operations can be handled in this method , Such as downloading files and so on .
3.onProgressUpdate(Progress… values) ( Running on the UI In the thread ) ( Non essential method , You don't have to implement )
This function is used to execute tasks in the thread pool Running state , Call back to UI The progress of the main thread , Such as uploading or downloading progress .
4.onPostExecute(Result result)( Running on the UI In the thread ) ( Non essential method , You don't have to implement )
This function represents that the execution of the task in the thread pool has ended , Call back to UI The result of the main thread . For example, download results .
边栏推荐
- Cultivate children's creativity under the concept of project steam Education
- 路由跳轉之點擊列錶的操作按鈕,跳轉至另一個菜單頁面並激活相應的菜單
- 解析创客空间机制建设的多样化
- Group note data representation and operation check code
- Plug in installation and shortcut keys of jupyter notebook
- Oracle exercise
- Classic model alexnet
- XGBoost, lightGBM, CatBoost——尝试站在巨人的肩膀上
- Kotlin quick start
- 指南针app是正规的吗?到底安不安全
猜你喜欢
Mysql database foundation
stm32Cubemx:看门狗------独立看门狗和窗口看门狗
On virtual memory and oom in project development
Tupu software is the digital twin of offshore wind power, striving to be the first
Analysis on the diversification of maker space mechanism construction
少儿编程对国内传统学科的推进作用
“再谈”协议
【论文笔记】Manufacturing Control in Job Shop Environments with Reinforcement Learning
经典模型——AlexNet
丝网印刷的种类及其应用方法
随机推荐
小米电视的网页和珠宝的网页
使用IDEA画结构图
Business process diagram design
Cloud Computing Foundation -0
Add an "open search description" to the site to adapt to the browser's "site search"“
微信小程序开发准备工作
Lumen Analysis and Optimization of ue5 global Lighting System
[reading papers] fbnetv3: joint architecture recipe search using predictor training network structure and super parameters are all trained by training parameters
计组笔记——CPU的指令流水
如何筹备一场感人的婚礼
数字孪生智慧水务,突破海绵城市发展困境
Various errors in kitti2bag installation
Group counting notes - instruction pipeline of CPU
Insect structure and Deconstruction
HL7Exception: Can‘t XML-encode a GenericMessage. Message must have a recognized struct
Hardware creation principle of campus maker space
Where is it safe to open a fund account?
Route jump: click the operation button of the list to jump to another menu page and activate the corresponding menu
经典模型——ResNet
Network PXE starts winpe and supports UEFI and legacy boot