1

我的 android 应用程序中有一个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(...) );
4

1 回答 1

1

相同。

public void notify (String tag, int id, Notification notification) 自:API Level 5

发布要在状态栏中显示的通知。如果您的应用程序已经发布了具有相同标签和 id 的通知并且尚未取消,它将被更新的信息替换。*

参数 tag 此通知的字符串标识符。可能为空。id 此通知的标识符。对 (tag, id) 在您的应用程序中必须是唯一的。notification 一个 Notification 对象,描述向用户显示什么。不得为空。

于 2011-11-10T22:35:56.710 回答