zoukankan      html  css  js  c++  java
  • android 通知栏 notifcation

      http://blog.csdn.net/guolin_blog/article/details/50945228  郭神的博客

    final NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    final Notification notification = builder.setContentTitle("这是通知标题").setContentText("这是通知的内容").
    setWhen(System.currentTimeMillis()).setSmallIcon(R.mipmap.ic_launcher).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
    .setColor(Color.parseColor("#EAA935")).build();


    final Notification notification2 = builder.setContentTitle("这是通知标题2").setContentText("这是通知的内容2").
    setWhen(System.currentTimeMillis()).setSmallIcon(R.mipmap.ic_launcher).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
    .build();


    btn_notification = (Button) findViewById(R.id.btn_notification);
    btn_notification2 = (Button) findViewById(R.id.btn2);

    btn_notification.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    manager.notify(1, notification);
    }
    });

    btn_notification2.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    manager.notify(2, notification2);
    }
    });
  • 相关阅读:
    Rabbitmq 性能测试
    B+树图文详解
    图的概念和存储(邻接矩阵,邻接表)
    WebApi系列文章
    Asp.Net MVC项目集成Swagger
    正则表达式匹配两个特殊字符中间的内容
    数学常数e的含义
    十大排序算法总结
    C#集合类型大揭秘
    深入System.Web.Caching命名空间 教你Hold住缓存管理(三)
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5542304.html
Copyright © 2011-2022 走看看