Reputation: 19572
I have a long list of item so instead of a spinner I used an autocompletetextview.
In an autocompletetextview if I have used an ArrayAdapter with custom objects how would I know which item in the array is what the user "selected"/accepted in the automplete?
Upvotes: 0
Views: 43
Reputation: 917
Try this...
autocompletetextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
for (int j = 0; j < listSchool.size(); j++) {
if (listSchool.get(j).getSchool_name().equals(adapter.getItem(i).toString())) {
school_name = listSchool.get(j).getSchool_name();
school_id = listSchool.get(j).getSchool_id();
break;
}
}
}
});
Hope this will help you.
Upvotes: 1