@@ -0,0 +1,1339 @@
+package com.thread.androidthreadtest;%0A%0Aimport android.os.AsyncTask;%0Aimport android.util.Log;%0A%0A/*%0A * This class show usage of AsyncTask, to start the task, call downloadTask.execute()%0A */%0Apublic class DownloadTask extends AsyncTask%3CVoid, Integer, Boolean%3E %7B%0A%0A    private static final String TAG = %22ThreadTest/DownloadTask%22;%0A%0A    @Override%0A    protected void onPreExecute() %7B%0A        Log.i(TAG, %22%5BonPreExecute%5D show progress dialog%22);%0A    %7D%0A%0A    @Override%0A    protected Boolean doInBackground(Void... params) %7B%0A        try %7B%0A            while (true) %7B%0A                int downloadPercent = doDownload();%0A                publishProgress(downloadPercent);%0A                if (downloadPercent %3E= 100) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A%0A    private int doDownload() %7B%0A        return 0;%0A    %7D%0A%0A    @Override%0A    protected void onProgressUpdate(Integer... values) %7B%0A        Log.i(TAG, %22%5BonProgressUpdate%5D progressis %22 + values%5B0%5D);%0A    %7D%0A%0A    @Override%0A    protected void onPostExecute(Boolean result) %7B%0A        Log.i(TAG, %22%5BonPostExecute%5D%22);%0A        if (result) %7B%0A            Log.i(TAG, %22Downloaded success%22);%0A        %7D else %7B%0A            Log.i(TAG, %22Downloaded failed%22);%0A        %7D%0A    %7D%0A%0A%7D%0A

add sample implementation of AsyncTask