Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to tie specific pending intents to specific buttons on specific widgets on a multi-widget.. appwidget?
    primarykey
    data
    text
    <p>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?</p> <pre><code>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&lt; 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 )); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload