android - Textwatcher filtering list -


i have problem , seems me has it. have implemented textwatcher , when filtering string in listview it's showing object twice in list.

this i'm doing

filtertext = (edittext) findviewbyid(r.id.edittext01); filtertext.addtextchangedlistener(filtertextwatcher); 

and here adapter , textwatcher.

        adapter2 = new simpleadapter(listbased.this, listbasedlist,                 r.layout.list_item,new string[]                         { tag_location_name, tag_address, tag_dist, tag_postal, tag_location_id, tag_city, tag_company_id, tag_lat, tag_lng}, new int[] {                         r.id.location_name, r.id.location_adress, r.id.dist, r.id.postal, r.id.location_location_id, r.id.location_city, r.id.location_company_id, r.id.lat, r.id.lng});                     setlistadapter(adapter2);     } }  private textwatcher filtertextwatcher = new textwatcher()  {     public void aftertextchanged(editable s) {          }     public void beforetextchanged(charsequence s, int start, int count,             int after) {     }     public void ontextchanged(charsequence s, int start, int before,             int count) {         adapter2.getfilter().filter(s);     } }; 

its working fine typed here screenshot how showing it.

screenshot here!

anyone can explain me issue?

i had same problem. figured out. due have same text "sindal" in name , city fields of list.


Comments