一、基础的知识了解

    

    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通知栏的使用的更多相关文章

  1. Notification通知栏

    Notification通知栏 首先实现的功能就是通知栏显示Notification,Notification是显示在系统的通知栏上面的,所以Notification 是属于进程之前的通讯.进程之间的 ...

  2. android自定义Notification通知栏实例

    项目有个需求,需要在发送Notification的时候动态给定url的图片.大概思路如下:自己定义一个Notification的布局文件,这样能够很方便设置View的属性. 首先加载网络图片,使用Bi ...

  3. 安卓开发笔记——Notification通知栏

    当用户有没有接到的电话的时候,Android顶部状态栏里就会出现一个小图标.提示用户有没有处理的快讯,当拖动状态栏时,可以查看这些快讯.Android给我们提供了NotificationManager ...

  4. Android Notification通知栏的使用,通知栏在Android8.0系统不显示的问题;

    1.正常使用通知栏: /** * 创建通知栏管理工具 */ NotificationManager notificationManager = (NotificationManager) getSys ...

  5. Android学习(二十)Notification通知栏

    一.通知栏的内容 1.图标 2.标题 3.内容 4.时间 5.点击后的相应 二.如何实现通知栏 1.获取NotificationManager. 2.显示通知栏:notify(id,notificat ...

  6. Android Notification通知栏使用

    package com.example.mynotifycation; import android.app.Activity; import android.app.Notification; im ...

  7. 22 Notification 通知栏代码

    结构图: MainActivity.java package com.qf.day22_notification; import android.app.Activity; import androi ...

  8. 安卓开发_浅谈Notification(通知栏)

    Notification通知栏是显示在手机状态的消息,代表一种全局效果的通知 快速创建一个Notification的步骤简单可以分为以下四步: 第一步:通过getSystemService()方法得到 ...

  9. Notification NotificationManager RemoteViews PendingIntent

    Notification和NotificationManager :可以用来实现可视化的消息通知等,比如:下载进度显示,消息显示,广播的内容等 RemoteViews :用于创建自定义的Notific ...

随机推荐

  1. code4906 删数问题

    题目: 键盘输入一个高精度的正整数n(<=240位), 去掉任意s个数字后剩下的数字按原左右次序将组成一个新的正整数. 编程对给定的n和s,寻找一种方案,使得剩下的数最小. Simple Inp ...

  2. 7.11 cookie 失效后 ,重新登陆 页面 可能跳出 框架 ,只剩主题 部分 ,

    判断地址 不在  框架里  (项目  地址栏一般 都是 首页地址 ) function url(){ var page=getpage(); if(window==top&&(page ...

  3. Activiti中23张表的含义

    1.与流程定义相关的4张表: 2.与执行任务相关的5张表: 3.与流程变量相关的2张表

  4. 2018.07.03 POJ 2318 TOYS(二分+简单计算几何)

    TOYS Time Limit: 2000MS Memory Limit: 65536K Description Calculate the number of toys that land in e ...

  5. hdu-1055(贪心)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1055 题意:给一棵树涂色,这棵树的每个节点都有自己的价值Ci,涂色的原则是只由这个节点的父节点涂色之后 ...

  6. 类内初始值(c++11)

    1.概念 1)可以为数据成员提供一个类内初始值,创建对象时,类内初始值用于初始化数据成员,没有初始值的成员将被默认初始化 2)类内初始值和赋值类似,或者放在花括号里(如数组),或者放在等号右边,不能使 ...

  7. Spring3.x错误----Bean named "txAdvice" must be of type[org.aopallibance.aop.Advice

    Spring3.x错误: 解决方法: aopalliance-1.0.jar 和 aopalliance-alpha1.jar之间的冲突.

  8. cxf maven依赖

         <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-front ...

  9. Airplace平台

    Demo: 左上角:(0, 0)开始导航,手机终端上实时在地图上当前所在显示,当前点以绿色点显示,轨迹点以红色显示. 系统架构:基于移动手机的以网络为辅助的架构.特点:低头顶交流,用户隐私和安全 &g ...

  10. struts2从浅至深(六)contextMap(存取数据)

    A:存数据 1.利用ActionContext存数据 这种方式最简便 这是一个购物车案例 把查询来的数据放入到Session中存储起来 2.利用valuestack值栈存数据 把查询出来的数据放入到值 ...