Android Notification的使用
来源:互联网 发布:大数据服务平台直播 编辑:程序博客网 时间:2024/04/30 17:40
创建和显示一个Notification需要如下5步:
1.通过getSystemService方法获得一个NotificationManager对象。
2.创建一个Notification对象。每一个Notification对应一个Notification对象。在这一步需要设置显示在屏幕上方状态栏的通知消息、通知消息前方的图像资源ID和发出通知的时间。一般为当前时间。
3.由于Notification可以与应用程序脱离。也就是说,即使应用程序被关闭,Notification仍然会显示在状态栏中。当应用程序再次启动后,又可以重新控制这些Notification。如清除或替换它们。因此,需要创建一个PendingIntent对象。该对象由Android系统负责维护,因此,在应用程序关闭后,该对象仍然不会被释放。
4.使用Notification类的setLatestEventInfo方法设置Notification的详细信息。
5.使用NotificationManager类的notify方法显示Notification消息。在这一步需要指定标识Notification的唯一ID。这个ID必须相对于同一个NotificationManager对象是唯一的,否则就会覆盖相同ID的Notificaiton。
- Android-Notification的使用
- Android Notification的使用
- android Notification 的使用
- android Notification 的使用
- Android Notification 的使用
- Android-Notification的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- 冷笑话一则
- 用SmartUpload进行文件上传
- Apache Http Server-Tomcat Mapping
- 冷笑话一则
- JAVA - JAVA2平台版本
- Android Notification的使用
- 冷笑话一则
- Remedy ITSM 7.6.04 套件快速安装
- 简单Java递归运算
- 编程者推荐学习书籍
- 对象 VS 数据结构 --概念
- 普通Jquery的ajax判断重复和formvalidator的ajaxValidator区别
- rolePermission-sqlmap.xml ( 编号:20110622A1605 )
- 用PL/SQL 将excel 导入Oracle