Notification通知栏的使用
一、基础的知识了解

1.pendingIntent : 它是Intent的封装,可以跳转某个Activity、给Service发送一个命令、还可以发送一个广播

2.进度条的使用方法

3.更新通知栏的信息

二、代码的编写
public void showNotification(FileInfo fileInfo) {
containsKey这个是Map函数是否包含你要写入的键值对的关键字
//if(mNotifications.containsKey())
//创建Notification的对象
Notification mNotification = new Notification();
//设置滚动文字
mNotification.tickerText = "开始下载";
//设置当前时间
mNotification.when = System.currentTimeMillis();
//设置图标
mNotification.icon = R.drawable.ic_launcher_background;
//设置通知属性(用户点击完之后会自动消失)
mNotification.flags = Notification.FLAG_AUTO_CANCEL;
//设置contentIntent通知方式
Intent intent = new Intent(mContext, MainActivity.class); //PendingIntent将Intent包装起来的函数
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
mNotification.contentIntent = pendingIntent;
}
Notification通知栏的使用的更多相关文章
- Notification通知栏
Notification通知栏 首先实现的功能就是通知栏显示Notification,Notification是显示在系统的通知栏上面的,所以Notification 是属于进程之前的通讯.进程之间的 ...
- android自定义Notification通知栏实例
项目有个需求,需要在发送Notification的时候动态给定url的图片.大概思路如下:自己定义一个Notification的布局文件,这样能够很方便设置View的属性. 首先加载网络图片,使用Bi ...
- 安卓开发笔记——Notification通知栏
当用户有没有接到的电话的时候,Android顶部状态栏里就会出现一个小图标.提示用户有没有处理的快讯,当拖动状态栏时,可以查看这些快讯.Android给我们提供了NotificationManager ...
- Android Notification通知栏的使用,通知栏在Android8.0系统不显示的问题;
1.正常使用通知栏: /** * 创建通知栏管理工具 */ NotificationManager notificationManager = (NotificationManager) getSys ...
- Android学习(二十)Notification通知栏
一.通知栏的内容 1.图标 2.标题 3.内容 4.时间 5.点击后的相应 二.如何实现通知栏 1.获取NotificationManager. 2.显示通知栏:notify(id,notificat ...
- Android Notification通知栏使用
package com.example.mynotifycation; import android.app.Activity; import android.app.Notification; im ...
- 22 Notification 通知栏代码
结构图: MainActivity.java package com.qf.day22_notification; import android.app.Activity; import androi ...
- 安卓开发_浅谈Notification(通知栏)
Notification通知栏是显示在手机状态的消息,代表一种全局效果的通知 快速创建一个Notification的步骤简单可以分为以下四步: 第一步:通过getSystemService()方法得到 ...
- Notification NotificationManager RemoteViews PendingIntent
Notification和NotificationManager :可以用来实现可视化的消息通知等,比如:下载进度显示,消息显示,广播的内容等 RemoteViews :用于创建自定义的Notific ...
随机推荐
- MacOs执行SQL出错(mysql)
上次修改过root密码之后,刚启动,执行sql就报错了. 错误是: Reset MySQL root password using ALTER USER statement after install ...
- 【转】MEF程序设计指南四:使用MEF声明导出(Exports)与导入(Imports)
在MEF中,使用[System.ComponentModel.Composition.ExportAttribute]支持多种级别的导出部件配置,包括类.字段.属性以及方法级别的导出部件,通过查看Ex ...
- final修饰符:
知识点: 1.final关键字用于修饰类.变量和方法 2.有点类似C#里的 sealed 关键字,用于表示它修饰的方法.变量和类不可以再被改变 3.final修饰变量时,表示该变量一旦获取了初始值,就 ...
- pip常用操作指令
1.安装模块 pip install vitualenv pip install -r requirement.txt 2.查询模块信息 pip show pip 3.显示已经安装的模块 pip li ...
- 2018.10.08 NOIP模拟 序列(主席树)
传送门 T2防ak题? 其实也不是很难(考试时sb了). 直接变形一下求出区间长度在[l2,r2][l2,r2][l2,r2]之间,中位数≤l1−1\le l1-1≤l1−1的区间数,和区间长度在[l ...
- 2018.06.29 NOIP模拟 1807(简单递推)
1807 题目背景 SOURCE:NOIP2015-SHY-2 题目描述 给出一个由数字('0'-'9')构成的字符串.我们说一个子序列是好的,如果他的每一位都是 1.8.0.7 ,并且这四个数字按照 ...
- 2018.08.14 bzoj4241: 历史研究(回滚莫队)
传送们 简单的回滚莫队,调了半天发现排序的时候把m达成了n... 代码: #include<bits/stdc++.h> #define N 100005 #define ll long ...
- 2018.07.18 洛谷P1171 售货员的难题(状压dp)
传送门 感觉是一道经典的状压dp,随便写了一发卡了卡常数开了个O(2)" role="presentation" style="position: relati ...
- java redis基本操作
package com.redis; import java.util.ArrayList;import java.util.Iterator;import java.util.List;import ...
- Django 必会面试题总结
1 列举Http请求中常见的请求方式 HTTP请求的方法: HTTP/1.1协议中共定义了八种方法(有时也叫“动作”),来表明Request-URL指定的资源不同的操作方式 注意: 1)方法名称是 ...