当前位置: 首页 > news >正文

苏州企业网站设计企业做兼职网上哪个网站好

苏州企业网站设计企业,做兼职网上哪个网站好,制作ppt的软件哪个好,正规货源网站大全Android#xff1a;从通知中删除通知b我已经创建了一个应用程序#xff0c;并且我设法在android通知栏中添加通知。 现在我需要示例如何从事件通知栏中删除该通知#xff1f;11个解决方案197 votes你可以尝试这个快速代码public static void cancelNotification(Context ctx…Android从通知中删除通知b我已经创建了一个应用程序并且我设法在android通知栏中添加通知。 现在我需要示例如何从事件通知栏中删除该通知11个解决方案197 votes你可以尝试这个快速代码public static void cancelNotification(Context ctx, int notifyId) {String ns Context.NOTIFICATION_SERVICE;NotificationManager nMgr (NotificationManager) ctx.getSystemService(ns);nMgr.cancel(notifyId);}Ankit Patial answered 2019-05-23T02:26:35Z155 votes这很简单。 您必须在NotificationManager上调用cancel或cancelAll。 cancel方法的参数是应该取消的通知的ID。请参阅API[http://developer.android.com/reference/android/app/NotificationManager.html#cancel(int)]RoflcoptrException answered 2019-05-23T02:26:10Z58 votes您也可以在通知管理器上调用cancelAll这样您甚至不必担心通知ID。NotificationManager notifManager (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);notifManager.cancelAll();编辑我被downvoted所以也许我应该指定这只会从您的应用程序中删除通知。Stephane Mathis answered 2019-05-23T02:27:06Z10 votes只需像下面的代码一样设置setAutoCancel(True)Intent resultIntent new Intent(GameLevelsActivity.this, NotificationReceiverActivityAdv.class);PendingIntent resultPendingIntent PendingIntent.getActivity(GameLevelsActivity.this,0,resultIntent,PendingIntent.FLAG_UPDATE_CURRENT);NotificationCompat.Builder mBuilder new NotificationCompat.Builder(getApplicationContext()).setSmallIcon(R.drawable.icon).setContentTitle(adv_title).setContentText(adv_desc).setContentIntent(resultPendingIntent)//HERE IS WHAT YOY NEED:.setAutoCancel(true);NotificationManager manager (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);manager.notify(547, mBuilder.build());farhad.kargaran answered 2019-05-23T02:27:30Z6 votes如果要从使用前台启动的服务生成通知startForeground(NOTIFICATION_ID, notificationBuilder.build());然后发行notificationManager.cancel(NOTIFICATION_ID);取消通知amp; 通知仍会显示在状态栏中。 在这种特殊情况下您将通过两种方式解决这些问题1 GT; 在服务中使用stopForeground(false)stopForeground( false );notificationManager.cancel(NOTIFICATION_ID);2 - ; 使用调用活动销毁该服务类Intent i new Intent(context, Service.class);i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);if(ServiceCallingActivity.activity ! null) {ServiceCallingActivity.activity.finish();}context.stopService(i);第二种方式更喜欢音乐播放器通知更多因为不仅通知删除而且还删除播放器... !!Dhruv Raval answered 2019-05-23T02:28:30Z5 votes这将有助于NotificationManager mNotificationManager (NotificationManager)getSystemService(NOTIFICATION_SERVICE);mNotificationManager.cannelAll();如果您通过调用创建通知startForeground();在Service.you可能需要打电话stopForeground(false);首先然后取消通知。pilotmario answered 2019-05-23T02:29:15Z1 votes使用NotificationManager取消通知。 您只需提供通知ID即可mNotificationManager.cancel(YOUR_NOTIFICATION_ID);还请查看此链接见Developer LinkMuhammad Usman Ghani answered 2019-05-23T02:29:54Z1 votes在Android APIgt; 23上您可以执行以下操作来删除一组通知。for (StatusBarNotification statusBarNotification : mNotificationManager.getActiveNotifications()) {if (KEY_MESSAGE_GROUP.equals(statusBarNotification.getGroupKey())) {mNotificationManager.cancel(statusBarNotification.getId());}}Szabolcs Becze answered 2019-05-23T02:30:18Z1 votesNotificationManager.cancel(id)是正确的答案。 然而您可以通过删除整个通知渠道来删除Android Oreo及更高版本的通知。 这应删除已删除频道中的所有邮件。以下是Android文档中的示例NotificationManager mNotificationManager (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);// The id of the channel.String id my_channel_01;mNotificationManager.deleteNotificationChannel(id);gil.fernandes answered 2019-05-23T02:30:49Z1 votes请试试这个public void removeNotification(Context context, int notificationId) {NotificationManager nMgr (NotificationManager) context.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);nMgr.cancel(notificationId);}Akansha patel answered 2019-05-23T02:31:09Z0 votes只需拨打IDpublic void delNoti(int id) {((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).cancel(id);}phnghue answered 2019-05-23T02:31:35Z
http://www.yutouwan.com/news/277103/

相关文章:

  • 沂源网站开发论坛网站怎么做
  • 毕业设计网站设计说明书注册网站网
  • 描述网站建设规范方法网站建设套餐内容
  • 网站做301根目录在哪里wordpress怎么保持缩略图尺寸不变
  • 个人 网站备案微信公众号移动网站开发
  • 可做外链的视频网站广州抖音推广
  • 建设厅电工证查询网站天猫建设网站的意义
  • 品牌宣传型企业网站长沙装修
  • 云电脑注册网站首页wordpress 注册邀请码
  • 苏州建设公司网站唐山建设公司网站
  • 焦作网站建设服务爱妮微如何做网站链接的网址
  • 通达oa 做网站深圳市大鹏建设局网站
  • 做网站学哪些语言给别人做网站用做假酒验证
  • 提高网站的访问速度网站怎么做付费项目
  • 网站技术建设方案高邮城乡建设局 网站
  • 哪些网站是单页应用怎样建微信公众号
  • 公司门户网站建设做网站需要懂程序吗
  • 桂平做网站公司上海临港自贸区注册公司
  • wordpress站点美化网站制作维护费 归属
  • 登陆建设银行wap网站网站建设中怎么回事
  • 店面设计费用西青seo
  • 广州做网站多少钱中山做网站公司哪家好
  • 山西省财政厅网站三基建设专栏网站集约化建设工作打算
  • wordpress 企业网站主题谷歌seo搜索
  • 本地服务器如何做网站百度一下你就知道主页
  • 从化高端网站建设岳阳网站开发建设
  • 网站常用英文建设网站费用吗
  • 房地产微网站模板上海公司买房需要什么条件
  • 东莞一站式网站建设企业网站后台管理系统
  • 大气建站工作室网站源码西安网站建设易网宣