I am working on widgets where I need to programmatically control the width and height of a widget when the device rotates from portrait to landscape and landscape to rub. To do this, when changing the configuration, I call the code below to programmatically update the width of the widget:
for (int id : appWidgetIds){
Bundle newOptions = appWidgetManager.getAppWidgetOptions(id);
int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, 0);
newOptions.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth - 100);
appWidgetManager.updateAppWidgetOptions(id, newOptions);
}
After that, I get a call to onAppWidgetOptionsChanged () with the new values, but the widget does not change.
However, I also call onUpdate () .
minSdkVersion - 16.
I searched a lot, but could not find related to this problem, thanks if in advance for your precious time.
thank
source
share