Application widget with bundle?

Posted by Varand pezeshk on Stack Overflow See other posts from Stack Overflow or by Varand pezeshk
Published on 2011-01-11T22:15:00Z Indexed on 2011/01/12 0:53 UTC
Read the original article Hit count: 140

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about android

Related posts about android-widget