android - Xamarin - Get adapter's filter count -
I am using a list view that is full of an adapter, which has a filter that works well Update updates list view, and update with DataSetChanged. But now I want to show the number of list view items.
I tried
searchView.QueryTextChange + = (sender, e) => {_adapter.filter.InvokeFilter (e.NewText); Title = _adapter.Count; // also tried listView.Count}; But this reflects the number of objects of last search, not currently. Is a filter similar to the listener, so can I get updated results?
I have seen it, but how can I apply it?
Your class should implement IFilterListener . After that, you add your class insence to the invoke filter method, which results in the interface methods called when your filter is complete.
class MyClass: Android.Widget.Filter.IFilterListener {... searchView.QueryTextChange + = (Sender, E) => {_adapter.filter.InvokeFilter (e.New text, this); }; ... Public Zero onFilterComplete (int count) {title = count.ToString (); }}
Comments
Post a Comment