zoukankan      html  css  js  c++  java
  • 通知栏设置

    一般在service里设置

        

    public static NotificationManager nm;

    private String _title;
    private String _artist;


    /** * 当开始播放时,通知栏显示当前播放信息 */ private void ShowNotifcation() { nm = (NotificationManager) getApplicationContext().getSystemService( Context.NOTIFICATION_SERVICE);//获取通知栏系统服务对象 notification = new Notification();// 实例化通知栏 notification.icon = R.drawable.icon;// 为通知栏增加图标 notification.defaults = Notification.DEFAULT_LIGHTS;// 默认灯 notification.flags |= Notification.FLAG_AUTO_CANCEL;// 永远驻留 notification.when = System.currentTimeMillis();// 获得系统时间 notification.tickerText = _title; notification.tickerText = _artist; Intent intent2 = new Intent(getApplicationContext(), PlayMusicActivity.class); intent2.putExtra("_ids", _ids); intent2.putExtra("_titles", _titles); intent2.putExtra("_artists", _artists); intent2.putExtra("position", position); PendingIntent contentIntent = PendingIntent.getActivity( getApplicationContext(), 0, intent2, PendingIntent.FLAG_UPDATE_CURRENT); notification.setLatestEventInfo(getApplicationContext(), "播放中", _title, contentIntent); nm.notify(0, notification); }
  • 相关阅读:
    标签平滑Label Smoothing
    py 中传参时**符号学习
    RoBERTa模型学习
    获取bert所有隐层的输出
    json.dumps||ensure_ascii
    nn.LSTM输入、输出、参数及pad
    py中的heapq操作
    fastnlp中的CRF补齐的padding?
    P3393 逃离僵尸岛 最短路dijkstra
    P2057 [SHOI2007]善意的投票 最小割
  • 原文地址:https://www.cnblogs.com/ct732003684/p/2851425.html
Copyright © 2011-2022 走看看