开发者社区> 问答> 正文

Notification 好奇怪的问题= = !

平时好得不能再好的一段代码今晚打开androidstudio ,代码段:

notification.setLatestEventInfo(
 MainActivity.this, 
getString(R.string.app_name),
 "我是string", 

contextIntent);

报错:参数不匹配
(并提示我我写的参数是 MainActivity.this, string, string, contentIntent)
这明明是正常的参数= =,是android的api不一样了还是另有原因?

展开
收起
爵霸 2016-03-03 14:59:26 2252 0
1 条回答
写回答
取消 提交回答
  • 1.首先这个在高版本的api 中不建议使用了;
    2.估计你最后一个参数真的不对

     public void setLatestEventInfo (Context context, CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) 
    Added in API level 1
    
    This method was deprecated in API level 11.
     Use Notification.Builder instead. 

    最后一个参数是 PendingIntent 你可能当成 Intent

    2019-07-17 18:51:27
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载