• 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);
    }
    });
  • 相关阅读:
    一点创业想法
    【转】Java程序员常用工具类库
    向着高薪前进
    web开发可不可以是这样的?
    java 读取文本文件超简单的方法
    java操作xml超简单的方法
    Dijkstra算法
    ubuntu linux下如何配置ip地址以及DNS
    有关于string的一些用法
    Linux mint 17.2 系统下安装hust oj
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5542304.html
Copyright © 2020-2023  润新知