I have a Widget i am working on, that allows the user to have more then one instance of the widget on his screen. Each Widget id maintains its own configuration file. However for some odd reason my code that is responsible for setting up the buttons individually for each widget id is not working, only the first widget id is linked to each individual widget. below is the code that is responsible. Can anyone see where the problem is?
private void TieClicks(Context context){
RemoteViews rViews;
PendingIntent editPendingIntent= null;
// Intent updateintent = new Intent(context,SyncNoteWidget.class);
// updateintent.setAction(SyncNote_Action_Widget_Update);
// PendingIntent pendingupdateintent = PendingIntent.getBroadcast(context, 0, updateintent, 0);
// rViews.setOnClickPendingIntent(R.id.widgettextview , pendingupdateintent);
//
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
int[] ids = appWidgetManager.getAppWidgetIds(new ComponentName(context, SyncNoteWidget.class));
for (int i =0;i< ids.length;i=i+1){
int wId = ids[i];
rViews = new RemoteViews(context.getPackageName(),R.layout.widget);
editPendingIntent = makeControlPendingIntentActivity(context, wId);
Log.v("syncnote", "tieing " + String.valueOf(wId));
rViews.setOnClickPendingIntent(R.id.widgeteditbutton , editPendingIntent);
appWidgetManager.updateAppWidget(wId, rViews);
editPendingIntent= null;
}
}
private PendingIntent makeControlPendingIntentActivity(Context context,int appWidgetId) {
Intent active = new Intent(context, EditNote.class);
active.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
active.setAction(com.ntu.way2fungames.syncnote.SyncNoteWidget.SyncNote_Action_Edit);
active.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
return(PendingIntent.getActivity(context, 0, active, 0 ));
}