【发布时间】:2011-10-18 23:04:48
【问题描述】:
我正在通过org.apache.http.client.HttpClient 在android 中上传文件,我需要实现进度条。是否可以从以下方面获取进度?
HttpPost httppost = new HttpPost("some path");
HttpClient httpclient = new DefaultHttpClient();
try {
File file = new File("file path");
InputStream in = new BufferedInputStream(new FileInputStream(file));
byte[] bArray = new byte[(int) file.length()];
in.read(bArray);
String entity = Base64.encodeToString(bArray, Base64.DEFAULT);
httppost.setEntity(new StringEntity(entity));
HttpResponse response = httpclient.execute(httppost);
}
如果没有,请显示另一种方法。谢谢
【问题讨论】:
-
这篇文章可能是您正在寻找的内容:Java FileUpload with progress.
标签: android