Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.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 Alarm PendingEvent发送的意向在捆绑包中具有空包裹_Android_Android Intent_Parcelable - Fatal编程技术网

Android Alarm PendingEvent发送的意向在捆绑包中具有空包裹

Android Alarm PendingEvent发送的意向在捆绑包中具有空包裹,android,android-intent,parcelable,Android,Android Intent,Parcelable,我正试图通过一个等待报警的意图发送一个包,但包裹数据似乎总是空的。可变高铁是一种可包裹的物体。这是我的密码: for (final HolderSubjectReminder hsr : alHolderSubjectReminders) { int hours = 23; int minutes = 0; DateTime alarmDate = new DateTime().dayOfMonth().roundFloorCopy().plusHours(hours).plus

我正试图通过一个等待报警的意图发送一个包,但包裹数据似乎总是空的。可变高铁是一种可包裹的物体。这是我的密码:

for (final HolderSubjectReminder hsr : alHolderSubjectReminders) {


  int hours = 23;
  int minutes = 0;
  DateTime alarmDate = new DateTime().dayOfMonth().roundFloorCopy().plusHours(hours).plusMinutes(minutes);
  Intent intent = new Intent("com.mycompany.ediary");
  Bundle bundle = new Bundle();
  bundle.putParcelable("Reminder", hsr);
  intent.putExtras(bundle);

  pendingIntent = PendingIntent.getBroadcast(con, count, intent, 0);
  alarmManager.set(AlarmManager.RTC_WAKEUP, alarmDate.getMillis(), pendingIntent);
}
在my BroadcastReceiver(在正确的时间接收广播)中:


在广播接收器中检索时,变量hsr始终为空。我做错了什么?顺便说一下,bundle也不是null

也许你在应用程序中创建的待处理意图多于这些意图。在这种情况下,您应该使用,
pendingent.FLAG\u CANCEL\u CURRENT
从头开始创建意图并为您的包充气:

例如:

pendingIntent = PendingIntent.getBroadcast(con, count, intent, PendingIntent.FLAG_CANCEL_CURRENT);
旗帜信息:


什么是高铁?“它初始化成什么了吗?”弗兰切斯克更新了答案谢谢!就这样!!
pendingIntent = PendingIntent.getBroadcast(con, count, intent, PendingIntent.FLAG_CANCEL_CURRENT);