How can I send Data from BroadcastReceiver to Widget?
Posted
by Yverman
on Stack Overflow
See other posts from Stack Overflow
or by Yverman
Published on 2010-05-05T11:24:35Z
Indexed on
2010/05/05
11:28 UTC
Read the original article
Hit count: 160
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);
}
}
© Stack Overflow or respective owner