java - How to redraw an ExpandableList within one of its Adapters functions? -
i have android application has expandablelist, in adapters getchildview(int,int,boolean,view,viewgroup)
want redraw expandablelist if conditions true, should do?
here answer not recommended:
this acitivity:
public class myactivity extends activity implements myadapterlistener{ private expandablelistview expandablelistview1; private myadapter adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); expandablelistview1 = (expandablelistview) findviewbyid(r.id.expandablelistview1); adapter = new myadapter(this); expandablelistview1.setadapter(adapter); } @override public void dorefresh() { adapter.notifydatasetchanged(); } }
this adapter:
public class myadapter extends baseexpandablelistadapter{ public interface myadapterlistener{ public void dorefresh(); } private myadapterlistener listener; public myadapter(myadapterlistener listener){ this.listener = listener; } @override public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent) { if(some condition true , want refresh list view){ listener.dorefresh(); } return null; } }
hope helps.
Comments
Post a Comment