I have a BroadcastReceiver which loads data from the Internet and then it should send them back to a Widget. But how can I do this?
What I've already done is updating the Widget directly from the Broadcast, but I like to just send de data back.
public class UpdateManager extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
ComponentName thisWidget = new ComponentName(context, Widget.class);
remoteViews.setTextViewText(R.id.widget_textview, "UPDATE DONE");
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}
}