我有一個包含進度條的通知。進度條更新代碼運行在一個service.Code低於發佈更改通知進度條
notificationManager.notify(42, notification);
while((count = inputStream.read(data)) != -1)
{
//new
downloadProgress += count;
outputStream.write(data,0,count);
//new
notification.contentView.setProgressBar(R.id.status_progress, contentLength, downloadProgress, false);
notificationManager.notify(42, notification);
}
我米麪對是因爲notificatoinManager.notify()
方法被稱爲在從流讀出的數據之間的問題,它減慢了複製過程。
我該如何解決這個問題?
我不認爲像這樣會顯着減慢下載過程:P 也許你可以在新的線程更新欄(調用通知方法)... –
是啊我也沒有,直到我執行代碼。 –