Android notification progressbar freezing
This is the code I'm using
h开发者_JS百科ttp://pastebin.com/3bMCKURu
The problem is that after some time (File gets more weight) notification bar get slower to pulldown, and finally it just freezes!
Your notifications are too frequent. thats why it freezes. make them update in bigger intervals. Ok is once in every second or 2 seconds.
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;
}
...
}
精彩评论