首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析symbol `PRIORITY_HIGH`

无法解析symbol `PRIORITY_HIGH`
EN

Stack Overflow用户
提问于 2016-12-06 04:14:54
回答 1查看 398关注 0票数 0

我试图显示一个提醒,但android studio根本无法识别符号PRIORITY_HIGH

代码如下:

代码语言:javascript
复制
 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);
EN

回答 1

Stack Overflow用户

发布于 2016-12-06 04:29:18

DEFAULT_ALL从API版本1开始就存在了,而

PRIORITY_HIGH是在API16版中引入的。

我假设您的API级别设置为介于这两者之间的值。

既然您正在使用compat库,那么您也应该使用来自该库的标志。

您有两种解决方案,将您的API版本提升到16+,或者使用

NotificationCompat.PRIORITY_HIGH

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40982547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档