I am using this example of autocompletetextview,now i am able to get name in suggestion,the output is like
ab
abc
but the issue is i want to get id and name in single row,like
1 ab
2 abc
I am using this example of autocompletetextview,now i am able to get name in suggestion,the output is like
ab
abc
but the issue is i want to get id and name in single row,like
1 ab
2 abc
You have to append id also with name. Have a look at following code:
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults filterResults = new FilterResults();
JsonParse jp=new JsonParse();
if (constraint != null) {
List<SuggestGetSet> new_suggestions =jp.getParseJsonWCF(constraint.toString());
suggestions.clear();
for (int i=0;i<new_suggestions.size();i++) {
// Append id and name here
suggestions.add(new_suggestions.get(i).getId()+" "+new_suggestions.get(i).getName());
}
filterResults.values = suggestions;
filterResults.count = suggestions.size();
}
return filterResults;
}