我想知道一些下载的进度。
当我从互联网上获取一些资源时,如下所示:
String myFeed = request.getURI().toString();
URL url = new URL(myFeed);
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection) connection;
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream in = httpConnection.getInputStream();
// Process the input stream
}
当“InputStream in = httpConnection.getInputStream();” 被调用,
文件的所有内容被一次下载。
如果我使用:
htttpResponse = httpClient.execute(httpRequestBase);
问题是一样的。
如何检测下载的实际进度?
谢谢你们!