AutoCompleteTextView mActv = (AutoCompleteTextView) findViewbyId(R.id.m_actv);
ArrayAdapter<String> AutoCompleteAdapter = new ArrayAdapter<String>(this,
R.layout.dropdown_text, Names);
mActv.setAdapter(AutoCompleteAdapter);
Names is a String array.
Is it possible to get the index of the text selected from the dropdown??
Thank You.
Simply add OnItemClickListener
(for clicked item) or OnItemSelectedListener
(for items selcted using a Trackball, Up/Down keys) to the AutoCompleteTextView
mActv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View arg1, int pos,
long id) {
String item = arg1.getItemAtPosition(pos);
//your stuff
}
});