I have an appwidget that I\'m trying to update from an activity.
To do that, I need the appwidget id.
I\'ve used AppWidgetManager.getAppWidgetIds
bu
To get the app widget ID.. use this below code
onReceive() method use this below code
int appWidgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
in onUpdate() you get the list of ids already as the parameter!
If you want to update it from activity use this
Intent intent = new Intent(this, [activityname].class);
intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
int ids[] = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds(new ComponentName(getApplication(), [activityname].class));
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,ids);
sendBroadcast(intent);