I have an AutoCompleteTextView. I set its adapter by extending a CursorAdapter. After selecting an option from the dropdown, I like to know the position of the item, or the item, that was selected. At least, I want an id for fetching more data in Sqlite. How can I do that?
Simply override the AutoCompleteTextView's OnItemClickedListener to find the position
of the item in the dropdown list or the SQLite row id
:
autoCompleteTextView.setOnItemClickedListener(new OnItemSelectedListener() {
@Override
public void onItemClicked(AdapterView<?> parent, View view, int position, long id) {
// Do whatever you want with the position or id
}
});