CopyPastor

Detecting plagiarism made easy.

Score: 1.9999177136945636; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2015-02-05
by Aritra Roy

Original Post

Original - Posted on 2015-02-05
by Aritra Roy



            
Present in both answers; Present only in the new answer; Present only in the old answer;

This is a common behavior. You shouldn't flood the NotificationManager with frequent updates. You should decide an interval to update, like twice every second.
For example,
long startTime; long elapsedTime = 0L; if (elapsedTime > 500) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { mBuilder.setProgress(100, (int) newValue, false); mNotifyManager.notify(notificationID, mBuilder.build()); startTime = System.currentTimeMillis(); elapsedTime = 0; } }); Log.d("Andrognito", newValue + "Progress"); } else elapsedTime = new Date().getTime() - startTime;
This works perfectly for me and doesn't freeze the notifications too. Hope this helps!
This is a common behavior. You shouldn't flood the NotificationManager with frequent updates. You should decide an interval to update, like twice every second.
For example,
long startTime; long elapsedTime = 0L; if (elapsedTime > 500) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { mBuilder.setProgress(100, (int) newValue, false); mNotifyManager.notify(notificationID, mBuilder.build()); startTime = System.currentTimeMillis(); elapsedTime = 0; } }); Log.d("Andrognito", newValue + "Progress"); } else elapsedTime = new Date().getTime() - startTime;
This works perfectly for me and doesn't freeze the notifications too.

        
Present in both answers; Present only in the new answer; Present only in the old answer;