Skip to content Skip to sidebar Skip to footer

Searchbox In Listview: Always The Same Result

when i use the serachbox for my Listview, i get everytime the same result. For Example: Car Flower Hate Love Water When I typef or h or l etc. the result is Car. I worked with thi

Solution 1:

Are you sure this line works?:

if(searchString.equalsIgnoreCase(toxinname.substring(0,textLength))){

Maybe try this instead:

if(toxiname.toUpperCase().indexOf(searchString.toUpperCase()) != -1)

Solution 2:

I found the problem. In the Activity the last three viewHolder worked with antidots and not with antidotsResult

Wrong:

viewHolder.sqlite_id.setText(antidots.get(position).get("sql_id").toString());
viewHolder.tox_layout.setText(antidots.get(position).get("toxin").toString());
viewHolder.antidot_layout.setText(antidots.get(position).get("antidot").toString());

Works:

viewHolder.sqlite_id.setText(antidotsResult.get(position).get("sql_id").toString());
viewHolder.tox_layout.setText(antidotsResult.get(position).get("toxin").toString());
viewHolder.antidot_layout.setText(antidotsResult.get(position).get("antidot").toString());

Post a Comment for "Searchbox In Listview: Always The Same Result"