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()