Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android通知条编号_Android_Notifications - Fatal编程技术网

Android通知条编号

Android通知条编号,android,notifications,Android,Notifications,我已经能够在Android仿真器上成功显示通知号码计数。然而,当我在实际的Android手机上使用它时,它不会显示任何内容。关于为什么会有差异,有什么建议吗?试着先用数字1设置,然后再调高。来自这里的建议: 数字字段 此值表示通知表示的当前事件数。相应的数字覆盖在状态栏图标的顶部。如果要使用此字段,则在首次创建通知时必须以“1”开头。(如果在更新期间将值从零更改为更大的值,则不会显示该数字。) (为子孙后代) 为了详细说明Izkata所说的话,如果您提交了一个没有“数字”计数的通知,然后您想添加

我已经能够在Android仿真器上成功显示通知号码计数。然而,当我在实际的Android手机上使用它时,它不会显示任何内容。关于为什么会有差异,有什么建议吗?

试着先用数字1设置,然后再调高。来自这里的建议:

数字字段

此值表示通知表示的当前事件数。相应的数字覆盖在状态栏图标的顶部。如果要使用此字段,则在首次创建通知时必须以“1”开头。(如果在更新期间将值从零更改为更大的值,则不会显示该数字。)

(为子孙后代)

为了详细说明Izkata所说的话,如果您提交了一个没有“数字”计数的通知,然后您想添加该数字,那么您需要取消现有的通知,并使用设置的数字字段重新制作它。(“取消”是NotificationManager方法之一。)从0变为数字不会显示数字,除非您取消原始通知

类似地,如果您有一个带有数字的通知,并且希望返回空白通知,则需要取消当前通知,并重新制作一个没有数字的通知。从一个数字到0只会显示一个没有任何内容的绿色小气泡


请注意,如果您只想更改现有号码,只需使用新号码重新发出通知,无需取消前一个号码。

在我的情况下,这是电话的问题。这是一个不可思议的机器人。它不适用于android 2.1,但Verizon发布的2.2解决了这个问题

      Take two global variable count, i;
         public void createNotification(View view){



NotificationManager mNotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.logo,
        "A new notification", System.currentTimeMillis());
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(this,SampleJsonReadingActivity.class);
PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
notification.setLatestEventInfo(this, "This is the title",
        "This is the text", activity);
if(count==1){
    count ++;
}
    else{
         i++;

    }
notification.number +=i;
mNotificationManager.notify(0, notification);
}


它对我有用……

通知号码是多少?有什么特别的电话吗?我想有些人实际上忽略了这个特性。我已经设置了一个通知,它用
builder.setContentText(“恢复”).setNumber(7)更新;notificationmanager.notify(1,builder.build())。我在通知抽屉中看到“恢复”文本和数字“7”,但该数字没有出现在通知栏图标上。知道为什么吗?事实上,这个数字出现在cyanogenmod平板电脑上,但在三星note 4上却没有,尽管两者都使用安卓4.4.4。