hi im trying create customfilter baseadapter , not having luck .. query database array of id, name , sex. , on listview wish search list have implemented textview , have had no luck code. here customadapter
public class mycustombaseadapter extends baseadapter { private static arraylist<custom> alist; private layoutinflater inflat; public mycustombaseadapter(context context, arraylist<custom> results) { alist = results; inflat = layoutinflater.from(context); } public int getcount() { return alist.size(); } public object getitem(int position) { return alist.get(position); } public long getitemid(int position) { long.parselong(alist.get(position).getid()); return position; } public view getview(int position, view convertview, viewgroup parent) { viewholder holder; if (convertview == null) { convertview = inflat.inflate(r.layout.suspect_list, null); holder = new viewholder(); holder.txtname = (textview) convertview.findviewbyid(r.id.suspect_name); holder.txtsex = (textview) convertview.findviewbyid(r.id.suspect_sex); holder.txtid = (textview) convertview.findviewbyid(r.id.suspect_id); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } holder.txtname.settext(alist.get(position).getname()); holder.txtsex.settext(alist.get(position).getsex()); holder.txtid.settext(alist.get(position).getid()); return convertview; } static class viewholder { textview txtname; textview txtsex; textview txtid; } }
i used custom filter in multiselectionlist. here code.
please download demo, run , try understand , use code per needs modification per requirement.
thanks.
Comments
Post a Comment