营山中学,青春不败101119,h漫画图
android notification使用详解
notification
核心代码(链式调用):适用于android 4.0以上(不兼容低版本)
notification noti = new notification.builder(this) .setcontenttitle("标题名称") .setcontenttext("标题里的内容") .setsmallicon(r.drawable.new_mail) .setlargeicon(bitmapfactory.decordresource(getresources(), r.drawable.ic_launcher)) .build(); notificationmanager nm = (notificationmanager) getsystemservice(notification_service); nm.notify(0, noti);
兼容版本
notification notification = new notification(r.drawable.ic_launcher, "xxxxxx", system.currenttimemillis()); //点击事件真正想执行的动作 intent intent = new intent(); intent.setaction(intent.action_dial); intent.setdata(uri.parse("tel:110")); pendingintent contentintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current); notification.setlatesteventinfo(this, "标题", "内容", contentintent); notificationmanager nm = (notificationmanager) getsystemmanager(notification_service); nm.notify(0, notification);
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android apk 项目一键打包并上传到蒲公英的实现方法
Android 自定义LineLayout实现满屏任意拖动功能的示例代码
android 限制某个操作每天只能操作指定的次数(示例代码详解)
Android 集成 google 登录并获取性别等隐私信息的实现代码
网友评论