-1

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

Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96

1 Answers1

2

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;
            }
Sachin Chandil
  • 17,133
  • 8
  • 47
  • 65