Reputation: 2962
I am in a scenario where AutoCompleteTextView should allow text only from the items present in its adapter.
I tried with spinner, but selecting items from spinner with huge list is annoying. So thought of having AutoCompleteTextView style.
Can anyone suggest a solution...
For example: If my adapter contains 1 2 3 11 21 31
User should able to enter only enter the items present Mean it u type 1, auto complete will show 1,11. so user should not able to enter rather than 1, 11 in above situation.
Thanks
Upvotes: 0
Views: 792
Reputation: 156
If you look at some of the cool apps in Play store where autocomplete is implemented, they usually take you to a new screen or activity and show the options in the listView. You can use the filter option in such cases. You can create a custom filter by overriding the getfilter() method as well.
check out the link here for an example of custom filters implementation.
You can also some out of the box gradle libraries and add it as a module dependency in your project as well:
These dependencies also have some extra cool features as well. I hope this was helpful to you.
Upvotes: 1