通知栏Notification使用
来源:互联网 发布:java 数据字典表设计 编辑:程序博客网 时间:2024/05/19 16:50
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);Notification mNotification = new Notification(R.drawable.icon_cat, "你有新的消息了", System.currentTimeMillis());PendingIntent contentIntent = PendingIntent.getActivity(context, 0, getIntent(), 0);mNotification.setLatestEventInfo(context, "天气预报", "晴转多云", contentIntent);mNotificationManager.notify(R.drawable.icon_dog, mNotification);
1、通过getSystemService(NOTIFICATION_SERVICE) 获取一个NotificationManager 对象
2、新建通知栏出现在顶端
3、新建系统维护的PendingIntent对象
4、设置出现在下拉栏消息
5、使用NotificationManager 把通知展示 第一个参数为Notification 唯一标识
mNotification2.flags = Notification.FLAG_ONGOING_EVENT; //设置notification 为常驻通知
cancelall() //清空所有通知
0 0
- 通知栏Notification使用
- Notification通知栏的使用
- Notification通知栏的使用
- Notification 通知栏的使用
- android Notification 通知栏使用
- 通知栏Notification基本使用
- 通知栏通知Notification
- Notification 通知栏通知
- Notification通知栏通知
- android中通知栏notification的使用
- adnroid,notification通知栏的使用
- Android 使用Notification自定义通知栏显示
- Android 通知栏 Notification 基本使用
- 使用RemoteViews自定义通知栏样式 Notification
- android通知栏(Notification)的使用
- android通知栏之Notification的使用
- Notification通知栏的基本使用
- Android--Notification通知栏的使用
- 图书馆管理系统
- 【2016.5.21普及组模拟】约数国王(A king)
- Python DM Learning Intro
- MySQL修改表结构及SQL性能优化
- nginx-tomcat负载均衡redis-session共享,静态资源分离
- 通知栏Notification使用
- mysql 默认引擎innodb 初探(三)
- 走近XML(1)
- php判断一个字符串包含另一个字符串
- 六个可以替代传统事务解决并发问题的建议
- Ubuntu 16.04 LTS直接双击安装deb包失败的解决方法
- Scroller 实现控件缓慢平移的效果
- Mac上安装Appium环境
- Ubuntu 16.04 LTS连接无线上网慢的解决