在我的安卓应用程序中有一个 Notification,并且 notification有一个进度条。
如果我更新 notification 的进度条的进度时,我是要传递 notification 的同一个实例呢,还是要传递 Notification 的一个新实例?
应该这样:
mNotification = new Notification(..); // create in the constructor of my activity
getNotificationManager().notify(TAG, FILE_UPLOAD_ID, mNotification);
还是:
getNotificationManager().notify(TAG, FILE_UPLOAD_ID, new Notification(...) );
public void notify (String tag, int id, Notification notification) Since: API Level 5
在状态栏发布一个通知。如果程序中已经有一个通知有相同的标签和id,这个通知还没有取消,就会被更新的信息代替。
参数标签A 字符串标识这个通知,可能为空,给这个通知分配 id 标识符。在程序中 tag,id 必须是唯一的。