Notification的简单使用
来源:互联网 发布:java 退出递归 返回值 编辑:程序博客网 时间:2024/06/06 03:25
实现Notification可以分为如下几步
1 利用builder设置Notification的属性,这一点与alertdialog类似,alerdialog也是通过类似的功能来设置对话框的属性。
2 通过设置好属性的builder创建一个Notification对象
3 通过系统服务获取NotificationManager
4 调用NotificationManager 的notify方法显示通知
代码实现如下
1 Builder builder = NotificationCompat.Builder(传入当前创建Notification的context对象);
builder.setSmallIcon(通知显示的图标ID)
builder.setContentTitle(通知的标题字符串)
builder.setContentText(通知的内容)
....... 可以设置其他很多属性大家可以自行查看,此处知识简单的实现
2 Notifcation notification = builder.builder()
3 NotificationManager manager =(NotificationManager ) getSystemService(Context.NOTIFICATION_SERVICE);
4 manager.notify(id,notification);
id是指定当前创见的Notification 用来以后的管理和更新此Notification
0 0
- notification的简单使用
- Notification的简单使用
- Notification的简单使用
- 简单而使用的NOTIFICATION
- Notification(通知)的简单使用
- Notification 最简单的使用
- Notification的使用简单的介绍
- Android学习之Notification的简单使用
- Notification.builder的简单使用√
- Android API- Notification(通知)的简单使用
- android 三种notification 的简单使用
- Notification 简单使用
- android简单实例-----------5种Notification的简单使用
- 简单的Notification
- Notification的简单用法
- Android Notification 通知 简单使用
- Android中通知(Notification)的简单使用
- Android---60---Notification 通知栏的简单使用
- ARM-Linux驱动相关头文件知识点
- Uniform Generator hdu-1014
- 最近想在tableviewcontroller上加一个固定悬浮窗,自己问了好多人,做了好多试验,终于成功了!
- uva 10048 - Audiophobia(floyd 的变形)
- Icon接口创建图标
- Notification的简单使用
- R-CNN实现物体检测网站
- 简单html5小活动开发——CSS基础之padding
- UINavigationController-UIBarButtonItem(翻页)
- jsp的九大内置对象
- 小猫统计——固定值
- Visio二次开发(一)----巧用Visio宏
- 软件缺陷
- 详细解说 STL 排序(Sort)