zoukankan      html  css  js  c++  java
  • 异步任务类AnsycTask的三个参数

    异步任务类AnsycTask为抽象类,其三个泛型参数为:ParamsProgressResult,这三个参数类型由用户设定,可以为任何类型,分别对应如下三个方法:

    1、doInBackground(Params...):该方法运行在子线程中,处理一些耗时的任务,如网络和数据库的操作。一般,Params 类型可以设为 Void;

    2、onProgressUpdate(Progress...):子线程中的publishProgress()方法被调用后,UI 线程将调用onProgressUpdate()方法,从而在界面上展示任务的进展情况。一般,Progress类型可以设为Integer;

    3、onPostExecute(Result):在doInBackground() 方法执行完成并 return 后,onPostExecute()方法将很快被 UI 线程调用,doInBackground()方法返回的数据将通过该方法传递到 UI 线程,可以利用返回的数据对 UI 进行操作。Result 类型为onPostExecute()方法返回的类型。

  • 相关阅读:
    probuf了解
    rebbitmq-RPC(C#)
    获取指定数量的有序列表
    RPC(Remote Procedure Call Protocol)
    正则表达式(c#)
    02_python函数
    01_python基础
    养生茶
    测试左右移浅淡
    python类的组合
  • 原文地址:https://www.cnblogs.com/Dionexin/p/6017223.html
Copyright © 2011-2022 走看看