ダウンロードの進行状況を知りたい。
次のように、インターネットからリソースを取得しているとき:
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);
問題は同じです。
ダウンロードの実際の進行状況を検出するにはどうすればよいですか?
皆さん、ありがとうございました!