Recently in one of my project I have to create auto complete text view in android. In this blog I am going to explain how to work with it.
First you have to add AutoCompleteTextView in your layout XML file.
Here we set threshold to 1 that means after typing first character it will show you matched suggestions. You can change it as per your requirement.
Then we have to set an adapter. Adapter is nothing but it's a collections of your suggestions.
As you can see above we have loaded our collections in array and created adapter from it and assigned adapter to locationList. That's it now it will show you suggestions as soon as you start typing it.
If you want to get value of it on change. You can do following.