android - notifydatasetchange() not working in post method of asynch task -
i have custom listview , data getting change frequently.so updating listview have registered broad cast receiver in activity , initialising list again , calling notifydataset change in post method.but list data not getting change.for temparary solution have intialised adapter object againg , setting againg.but feel not option.can 1 tell me how task.her code of broadcast receiver.
private class listenchange extends broadcastreceiver { @override public void onreceive(final context context, intent intent) { if(intent.getaction().equals(conversationlistactivitynew.action_change)) { if(is_activity_visible) { if (uri != null&&adapter!=null) { // adapter =null; // adapter = new messageadapternew(messagelistactivitynew.this, uri, searched_text); // setlistadapter(adapter); new asynctask<void,void,void>() { @override protected void doinbackground(void... voids) { adapter.getdata(messagelistactivitynew.this,uri); return null; } @override protected void onpostexecute(void avoid) { log.e("notifying row","notifying row"); messagelistactivitynew.this.adapter.notifydatasetchanged(); super.onpostexecute(avoid); } }.execute(); } } } } }
Comments
Post a Comment