if (Build.VERSION.SDK_INT > 10){ notification = new Notification(R.drawable.ic_stat_mintchip,"This is a test",System.currentTimeMillis()); notification.largeIcon = (((BitmapDrawable)c.getResources().getDrawable(R.drawable.ic_launcher)).getBitmap()); notification.defaults |= Notification.DEFAulT_ALL; notification.number += 1; notification.flags |= Notification.FLAG_auto_CANCEL; } else { notification = new Notification(R.drawable.ic_stat_mintchip,System.currentTimeMillis()); notification.flags |= Notification.FLAG_auto_CANCEL; notification.defaults |= Notification.DEFAulT_ALL; notification.number += 1; }}
我不太清楚为什么会这样.任何帮助?
解决方法 我认为这里的问题可能是你没有使用Notificaiton.Builder类.以下是您可以执行的 *** 作的一个小示例(您必须插入自己的变量,并设置您使用的其他属性,例如振动):Notification.Builder nb = new Notification.Builder(context) .setContentTitle("Title") .setContentText("content") .setautoCancel(true) .setLargeIcon(largeIcon) .setSmallicon(R.drawable.small_icon) .setTicker(s.getText());notificationmanager nm = (notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE);nm.notify(100,nb.build());总结
以上是内存溢出为你收集整理的android – 通知栏显示大图标和小图标全部内容,希望文章能够帮你解决android – 通知栏显示大图标和小图标所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)