How to get text from AutoCompleteTextView?
Yeah... unfortunately the name of the parameters on the onItemClick method you must implement are not so self-descriptive but here is an example with the names of what they are:
autoCompleteTextView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {
String selection = (String)parent.getItemAtPosition(position);
//TODO Do something with the selected text
}
});
- parent The AdapterView where the click happened.
- view The view within the AdapterView that was clicked (this will be a view provided by the adapter)
- position The position of the view in the adapter
- id The row id of the item that was clicked.
For more info see: http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html
arg0
being your AdapterView
and arg2
the position.
Have you tried:
arg0.getItemAtPosition(arg2);