I currently have an asynctask
which downloads a mp3 from a server. When the user starts to download it, a status bar notification is created. This displays the prog
I too experienced this problem. I was updating the progress bar WAY too often (even when the progress didn't change), here's how I fixed that:
// While loop from generic download method.
int previousProgress = 0;
while ((count = inputStream.read(buff)) != -1) {
outputStream.write(buff, 0, count);
totalBytesDownloaded += count;
int prog = (int) (totalBytesDownloaded * 100 / contentLength);
if (prog > previousProgress) {
// Only post progress event if we've made progress.
previousProgress = prog;
myPostProgressMethod(prog);
}
}
Now the app runs great and the user still receives a progress notification.