Android AppWidget RemoteViews工厂意图和putSerializable/putParcelable
在我的小部件中,我有集合中意图所需的设置 在方法onUpdate上的我的AppWidgetProvider子类中设置PendingEntTemplate 在我的RemoteViewsFactory getViewAt方法中,我有:Android AppWidget RemoteViews工厂意图和putSerializable/putParcelable,android,android-intent,android-appwidget,remoteview,Android,Android Intent,Android Appwidget,Remoteview,在我的小部件中,我有集合中意图所需的设置 在方法onUpdate上的我的AppWidgetProvider子类中设置PendingEntTemplate 在我的RemoteViewsFactory getViewAt方法中,我有: Bundle extras = new Bundle(); extras.putInt("pos", position); extras.putInt("date", new DateTime().millisOfDay().get()); //commen
Bundle extras = new Bundle();
extras.putInt("pos", position);
extras.putInt("date", new DateTime().millisOfDay().get());
//comment this to work
extras.putSerializable("d", new DateTime());
Intent fillInIntent = new Intent();
fillInIntent.putExtras(extras);
// Make it possible to distinguish the individual on-click
// action of a given item
row.setOnClickFillInIntent(R.id.list_view_row, fillInIntent);
我面临的问题是,我的活动已经开始,但是getViewAtmethod中没有额外的内容,但是,只要我对这些额外内容进行评论,就会出现新的DateTime;陈述
该活动获得所有其他额外费用,但可包裹额外费用除外,
AppWidgets SetOnClickFillinContent不支持Parcelableand Serializable extras的地方是否有文档记录
编辑:
Im使用以下意图模板:
Intent startActivityIntent = new Intent(context, MainActivity.class);
//startActivityIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityIntent
.setAction(Intent.ACTION_VIEW)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
.setData(Uri.parse(startActivityIntent.toUri(Intent.URI_INTENT_SCHEME)));
PendingIntent startActivityPendingIntent = PendingIntent
.getActivity(context, 0, startActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT);
views.setPendingIntentTemplate(R.id.list, startActivityPendingIntent);
检查您在AppWidgetProvider的PendingEvent中传递的标志类型