23
我想知道一些下載的進度。
當我收到從網上的一些資源, 這樣的:Android下載進度
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在= httpConnection.getInputStream();」被稱爲,
該文件的所有內容一次下載。
如果我使用:
htttpResponse = httpClient.execute(httpRequestBase);
的問題是一樣的。
如何檢測下載的實際進度?
謝謝大家!
我已經知道文件的大小,通過getContentLength()。 我不知道如何獲得已收到內容的進度。我只談論一個文件。 – Tsimmi 2010-01-20 11:41:55
哦,我明白了。好的,請參閱「如何創建下載管理器」鏈接。這有幫助嗎? – GaZ 2010-01-20 12:06:08
對不起!起初我沒有看到這個鏈接。 – Tsimmi 2010-01-20 12:44:26