WEB开发网
开发学院手机开发Android 开发 Android AsyncTask 阅读

Android AsyncTask

 2010-08-31 00:25:00 来源:WEB开发网   
核心提示:@Overridepublic void handleMessage(Message msg) {AsyncTaskResult result = (AsyncTaskResult) msg.obj;switch (msg.what) {case MESSAGE_POST_RESULT:// There is only

@Override

public void handleMessage(Message msg) {

AsyncTaskResult result = (AsyncTaskResult) msg.obj;

switch (msg.what) {

case MESSAGE_POST_RESULT:

// There is only one result

result.mTask.finish(result.mData[0]);

break;

case MESSAGE_POST_PROGRESS:

result.mTask.onProgressUpdate(result.mData);

break;

case MESSAGE_POST_CANCEL:

result.mTask.onCancelled();

break;

}

}

}

private void finish(Result result) {

if (isCancelled()) result = null;

onPostExecute(result);

mStatus = Status.FINISHED;

}

再看

protected final void publishProgress(Progress... values) {

sHandler.obtainMessage(MESSAGE_POST_PROGRESS,

new AsyncTaskResult(this, values)).sendToTarget();

}

上一页  1 2 3 

Tags:Android AsyncTask

编辑录入:coldstar [复制链接] [打 印]
赞助商链接