android - Update AppWidget's ListView from Activity -
i have appwidget listview within it. want update listview after add/remove/update item(s) activity class. have tried these before:
1)
intent intent = new intent(this, mywidgetprovider.class); intent.setaction("android.appwidget.action.appwidget_update"); int[] ids = { r.xml.widget_provider }; intent.putextra(appwidgetmanager.extra_appwidget_ids, ids); sendbroadcast(intent);
2)
appwidgetmanager appwidgetmanager = appwidgetmanager.getinstance(this); componentname thiswidget = new componentname(this, mywidgetprovider.class); int[] appwidgetids = appwidgetmanager.getappwidgetids(thiswidget); appwidgetmanager.notifyappwidgetviewdatachanged(appwidgetids, r.id.list);
3)
int widgetids[] = appwidgetmanager.getinstance(getapplication()).getappwidgetids(new componentname(getapplication(), mywidgetprovider.class)); (int id : widgetids) { appwidgetmanager.getinstance(getapplication()).notifyappwidgetviewdatachanged(id, r.id.list); }
and have no success. work, didn't.
now q is: there way 100% guaranteed update list view within appwidget?
android android-listview android-appwidget
No comments:
Post a Comment