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);
    }
    });
  • 相关阅读:
    HDU 1078 FatMouse and Cheese(DP)
    HDU 1160 FatMouse's Speed(DP)
    作业DAY019
    作业DAY018
    作业DAY017
    作业DAY016
    作业DAY015
    作业DAY014
    作业DAY013
    作业DAY012
  • 原文地址:https://www.cnblogs.com/jeno-song/p/5542304.html
Copyright © 2011-2022 走看看