【发布时间】:2013-09-05 09:07:30
【问题描述】:
我使用 NotificationCompat.Builder 构建了一个通知并显示它,我需要通知 NotificationManager 新的通知,所以我正在调用
NotificationManager mNotifyMgr = (NotificationManager) cont.getSystemService(Context.NOTIFICATION_SERVICE);
mNotifyMgr.notify(SOME_INT_NUMBER, builder.build());
但 Eclipse 将“notif(..)”标记为错误并带有标题:
Object类型中的notify()方法不适用于参数(int, Notification)
我很确定 notif(int, Notification) 存在: http://developer.android.com/reference/android/app/NotificationManager.html
谁能解释我做错了什么?
编辑: 我还发现我无法导入 android.app.NotificationManager,原因是:
导入的 android.app.NotificationManager 与同一文件中定义的类型冲突
【问题讨论】:
-
清理你的项目。那么它应该可以工作了。
-
@Sajmon 已经尝试过了...没有结果。
-
@Sajmon 最后你的答案是部分正确的 - 查看被选为答案的帖子。
标签: android android-notifications