这里的android很新:)
如果应用程序目标版本是>我有一个通知构建器,没有问题. 4
但是,当我切换到2.3时,我在这一行上收到错误,上面写着“Notificaiton.Builder无法解析为某种类型”.
Notification notification = new Notification.Builder(this)
.setSmallIcon(drawable_small)
.setLargeIcon(drawable_big)
.setWhen(System.currentTimeMillis()).setTicker(content_title)
.setContentTitle(content_title).setContentInfo(content_info)
.setContentText(content_text).setContentIntent(pIntent)
.getNotification();
这个问题现在解决了!
但是我现在又有了另一个
它给了我每个R(资源)的错误,我可以选择导入R.
如果我导入它,它会给我每个资源的错误.
setContentView(R.layout.activity_main);
解决方法:
像你这样实现你的通知
Notification noti = new NotificationCompat.Builder(context)
.setSmallIcon(icon_small)
.setTicker(message)
.setLargeIcon(largeIcon)
.setWhen(System.currentTimeMillis())
.setContentTitle(title)
.setContentText(message)
.setContentIntent(contentIntent)
//At most three action buttons can be added
.setAutoCancel(true).build();
import android.support.v4.app.NotificationCompat;
NotificationCompat帮助程序,用于以向后兼容的方式访问API级别4之后引入的Notification中的功能.
有关更多信息,请访问:http://developer.android.com/guide/topics/ui/notifiers/notifications.html