我试图显示一个提醒,但android studio根本无法识别符号PRIORITY_HIGH。
代码如下:
Intent intent1 = new Intent(context1,MainActivity.class);
PendingIntent pendingNotificationIntent = PendingIntent.getActivity(context1,0, intent1,PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context1);
builder.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(context1.getResources(), R.mipmap.ic_launcher))
.setContentTitle("MOODS")
.setContentIntent(pendingNotificationIntent)
.setContentText("Quote:\t"+quote+"\nAuthor:\t" +author)
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(Notification.PRIORITY_HIGH);发布于 2016-12-06 04:29:18
DEFAULT_ALL从API版本1开始就存在了,而
PRIORITY_HIGH是在API16版中引入的。
我假设您的API级别设置为介于这两者之间的值。
既然您正在使用compat库,那么您也应该使用来自该库的标志。
您有两种解决方案,将您的API版本提升到16+,或者使用
https://stackoverflow.com/questions/40982547
复制相似问题