开发者

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;
        }
...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜