How to notify Android Widget to redraw -
i have android widget using remoteviewsfactory
in order populate listview.
my data source asynchronous json call can done @ time (it's not push notification). right code located in ondatachanged
, looks this:
@override public void ondatasetchanged() { // subsequent calls data. // called when widget onreceive action_appwidget_update procs. newsgetter.updatelistfeed(null, new newsgetter.onupdatelistfeedfinishedlistener() { @override public void onupdatelistfeedfinished(volleyerror error) { //called when async call has finished. not sure call here? } }); log.e(tag, "******************************** ondatasetchanged provider"); }
every hour (i've set updateperiodmillis
update every hour) appwidgetprovider
gets onreceive
call asking update (action_appwidget_update
) , such above code runs. however, after code runs , updates feeditems
, ui never updates when scrolling.
so question is: how invalidate ui , tell redraw views?
so far i've tried:
appwidgetmanager.notifyappwidgetviewdatachanged(appwidgetid, r.id.widget_list);
but calls ondatachanged
cause infinite loop, can't use that.
the solution issue use localbroadcastmanager
send message remoteviewsfactory
appwidgetprovider
. example, see here: android onreceive not called
Comments
Post a Comment