Search code examples
androidfilterautocompletetextview

make custom filter for autocompletetextview android


hi my task is simple that make a autocompletetextview and show matched text in dropdown. But i want to change in filter.

Ex: my list is like D.Y.Patil College,Pune unversiry etc. I want that when user type dy or dyp it stat matching and display result.

How could i ignore whitespace and dot.

And also Could u plz tell me to how exactly autocompletetextview works.


Solution

  • Using by default adapter and filter, autocompletetextview can do only single line string in dropdown view as default adapter and default filter adapter.getFilter().filter(s.toString()); which can do filtering with condition of inputString.contains(stringOfList) one-bye-one and get and display that list in dropdown at autocompletextview.

    There for you have to make simple custom adapter and inside that custom filter class for filtering as per your requirement.