Reputation: 175
This is the code I'm using
The problem is that after some time (File gets more weight) notification bar get slower to pulldown, and finally it just freezes!
Upvotes: 4
Views: 3533
Reputation: 504
This solution worked for me (ugly but working):
private static int mPercentDownloaded;
@Override
protected Void doInBackground(String... params) {
...
mPercentDownloaded = (int) ((total * 100) / lenghtOfFile);
long currentDownloadTicks = System.currentTimeMillis();
if (currentDownloadTicks > mDownloadTicks + 1000) {
publishProgress(mPercentDownloaded);
mDownloadTicks = currentDownloadTicks;
}
...
}
Upvotes: 3
Reputation: 16110
Your notifications are too frequent. thats why it freezes. make them update in bigger intervals. Ok is once in every second or 2 seconds.
Upvotes: 3