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);

  • 相关阅读:
    Ajax实现动态的二级级联菜单
    使用 Struts 2 实现国际化
    使用 Struts2 校验器校验用户注册信息
    Python基础 9.正则
    Python基础 8.迭代器 生成器 包
    Python基础 7.异常
    Python基础 6 .文件操作
    Python基础 5.类
    Python基础 4.函数
    Python基础 3 控制流程
  • 原文地址:https://www.cnblogs.com/mada0/p/4830018.html
Copyright © 2011-2022 走看看