autocompletetextview setonitemselectedlistener not working

This is a duplicate of this question However, you need to use AdapterView.OnItemClickListener() not OnItemSelectedListener. I tested it with success using the following code snippet. Credit to Vogella for the adapter stuff. AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.autocomplete_textview); String[] values = new String[] { “Android”, “iPhone”, “WindowsMobile”, “Blackberry”, “WebOS”, “Ubuntu”, “Windows7”, “Max OS X”, “Linux”, “OS/2”, … Read more

Dynamically updating an AutoCompleteTextView adapter

I didn’t have any luck using adapter.notifyDataSetChanged() when dynamically adding and changing the data in the adapter. In my situation, I was hitting an external api asynchronously and getting a list of completion data periodically. This code clears the adapter, and adds the new data as you’d expect. However, I had to call the getFilter().Filter … Read more

TextInputLayout and AutoCompleteTextView

Now, with AndroidX you don’t need customise something. Need just add material component style (was added in 1.1.0-alpha06, see release notes). <com.google.android.material.textfield.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Example TextInputLayout”> <androidx.appcompat.widget.AppCompatAutoCompleteTextView style=”@style/Widget.MaterialComponents.AutoCompleteTextView.FilledBox” android:layout_width=”match_parent” android:layout_height=”wrap_content”/> </com.google.android.material.textfield.TextInputLayout>

AutoCompleteTextView item selection programmatically

To be clear, Tano’s solution is sufficient to answer this question. But, in case others run into the same use case I did, here’s some more background that may potentially help you… I had been running into this issue specifically while trying to make a non-editable Material Exposed Dropdown Menu and set it’s initial value … Read more