zoukankan      html  css  js  c++  java
  • Notification的使用(待完善)-〉添加点击取消,显示优化

    PendingIntent intent5 = PendingIntent.getActivity(this, LATESTNEWSNOTIFICATIONID, new Intent(
                        this, NotificationActivity.class), PendingIntent.FLAG_ONE_SHOT);
                NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
                builder.setContentTitle("这是通知的title..");
                builder.setContentText("这是内容文本....");
                builder.setSmallIcon(R.drawable.ic_launcher);// 小图片
                builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));// 大图标
                builder.setWhen(System.currentTimeMillis());// 设置通知发布时间
                builder.setContentIntent(intent5);

                Notification notification = builder.build();

                notificationManager.notify(LATESTNEWSNOTIFICATIONID, notification);

  • 相关阅读:
    为什么 "auto a = 1;" 在C语言中可以编译通过?
    谈谈duilib
    软工第一次作业
    数独_个人项目
    统计Github项目信息
    字符串中的匹配之递归
    软工第0次作业
    c++浅拷贝与深拷贝(LeetCode669)
    修改xcode初始生成代码
    树上处理的问题总结
  • 原文地址:https://www.cnblogs.com/mada0/p/4830018.html
Copyright © 2011-2022 走看看