当前位置:编程学习 > wap >>

httppost请求获取上传进度问题

现在已经上传成功了,我想在上传过程中加上一个上传实时进度,怎么获得上传进度。具体部分相关代码如下:

public void upload(String sessionId, Record record,
List<Map<String, Object>> list) {

Map<String, Object> requestObject = new HashMap<String, Object>();

requestObject.put("title", record.getTitle());
requestObject.put("content", record.getContent());
requestObject.put("longitude", record.getLongitude());
requestObject.put("latitude", record.getLatitude());
requestObject.put("recodeDate", record.getCreateTime());
requestObject.put("images", list);

StringResult result = this.postForObject(sessionId, StringResult.class,
requestObject);
}


class UploadAsyncTast extends AsyncTask<Void, Void, Integer> {

private Record record;
private List<Map<String, Object>> list;

public UploadAsyncTast(Record record, List<Map<String, Object>> list) {
this.record = record;
this.list = list;
}

@Override
protected Integer doInBackground(Void... params) {
try {
Log.i(TAG, sessionId + " UploadAsyncTast()执行");
imageHandler.upload(sessionId, record, list);
return 1;
} catch (Exception e) {
return 0;
}
}

@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
if (result == 1) {
Log.i(TAG, "图文上传成功");
} else {
Log.i(TAG, "图文上传失败");
}
}
}
进度条 http 异步线程 --------------------编程问答-------------------- 怎么沉了.............
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,