AsyncTask API 翻译

AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

AsyncTask 使操作UI线程更方便准确,这个类可以执行后台操作并在ui线程里发布结果,无需使用线程操作或handlers

AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework. AsyncTasks should ideally be used for short operations (a few seconds at the most.) If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent pacakge such as Executor, ThreadPoolExecutor and FutureTask.

AsyncTask 被设计成一个Thread和Handler的辅助类,并非基于线程框架. AsyncTask 应该被用于短时操作,如果想保持线程长时间运行,强烈建议使用其他API,比如Executor, ThreadPoolExecutor, FutureTask

An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread. An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute.

一个异步任务呗定义为 ,运行在后台线程,结果发布在UI线程(主线程), 一个异步任务被定义为3个参数, Params, Progress ,Result 4个步骤,onPreExecute(), doInBackground(), onProgressUpdate() ,onPostExecute()

转载于:https://my.oschina.net/u/925508/blog/106213

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值