Application widget with bundle?
- by Varand pezeshk
Hey guys, I have application widget, and I want to send some data to the intent that is attached to PendingIntent, by clicking the widget.
here's my code
final int N = appWidgetIds.length;
for (int i = 0; i < N; i++) {
int appWidgetId = appWidgetIds[i];
Intent intent = new Intent(context, UpComingBDays.class);
if(bdaysAmount != 0){
Bundle bundle = new Bundle();
bundle.putIntegerArrayList("WIDGETIDS", tempAllIDS);
intent.putExtras(bundle);
System.out.println("bund insertedddddddddddddd.....................");
}
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, 0);
RemoteViews remoteView = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
remoteView.setTextViewText(R.id.widget_text, finalText4TextView);
remoteView.setOnClickPendingIntent(R.id.WidgetImageButton, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, remoteView);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
I realize always "bund insertedddddddddd......" is printed on CatLog, but the intent's bundle is null.
what is incorrect? how can i send data by clicking on widget.
plz dont offer to use services as my code does not have anything with it.
many thanks.