I'm trying to change the background color of a ListView
in an active widget on the fly like so,
public static void updateWidgetTheme(Context context, int bgColor) {
RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.widget);
widget.setInt(R.id.listView, "setBackgroundColor", bgColor);
}
Which i'm calling from the Main activity of my app. There are active widgets. It seems to have no effect. I've read several questions where this is the appropriate way to change background color of a view in an active widget.
Why isn't this working?
Just changing your RemoteViews
is not enough - you need to call AppWidgetManager.updateAppWidget() with the appWidgetId
and your updated RemoteViews
to actually update the widget.