Renjith
Renjith

Reputation: 524

calculating the percentage downloaded and time remaining while downloading a file on android

I am having an android application that download songs from server to device. I am showing a progress dialog for this . I need to show the downloaded size , remaining size , elapsed time and time remaining to the user

How do I get these things from the application in Android?

Any pointers will be most useful.

Regards Renjith

Upvotes: 0

Views: 3432

Answers (1)

Raghunandan
Raghunandan

Reputation: 133560

You should use async task and override onProgressUpdate()

 @Override
 protected void onProgressUpdate(Integer... values) {
     Log.i("Value", values[0].toString());
     count++;
     progressBar.setProgress(count);
 }

Take a look at this link. Download a file with Android, and showing the progress in a ProgressDialog. The answer in the link should help you.

Calculate Percentage Downloaded and Time Remaining for in OTHER application. What's the best way to calculate remaining download time?

Upvotes: 1

Related Questions