I Have A Listview Which Contains More That 1 Value In A Row, How Can I Filter The List With A Name Value When I Type In Edittext?
Solution 1:
Making Items in an
ArrayAdapterfilterable:ArrayAdapterhas a built inArrayFilter, It compares the Objects in adapter list by using a string fromtoString().toLowerCase()for each object. If you overridetoString()inCityDataclass and return city name, thenArrayAdaptershould be able to filter items effectively.Enabling Automatic text filter on a
ListView: InListVieweither useandroid:textFilterEnabled="true"in layout or set it from code usingsetTextFilterEnabled(true). Now wheneverlistViewis in focus, user can simply bring up the keyboard, and start typing, list items will be automatically filtered.Explicitly setting text filter on a
ListView: UsesetFilterText()method ofListView. Do not forget to clear this afterward.
You can reveal more details by examining the relevant Android Sources.
Post a Comment for "I Have A Listview Which Contains More That 1 Value In A Row, How Can I Filter The List With A Name Value When I Type In Edittext?"