Android.widget.Filterable
Defines a type of behavior that can be filtered. Filterable interfaces are usually implemented with Android.widget.Adapter. An abstract method GetFilter () in interface filterable needs to be implemented.
Filter Android.widget.Filterable.getFilter ()
Returns a filter object that is used to filter out data that conforms to a certain pattern. The GetFilter () method is typically implemented in the Android.widget.Adapter class.
Android.widget.Filter
Typically, you implement the Filterable interface to create a filter object. The method filter (charsequence), filter (Charsequence, Filterlistener) implements the filtering operation asynchronously. Place a filtering request in the request queue and wait for processing. Cancels the last filter request that was not executed. To create a filter object, you need to implement at least two abstract methods:
Protected Filterresults performfiltering (charsequence constraint)
protected void Publishresults (charsequence constraint, filterresults results)
Method One:
Protected Filterresults performfiltering (charsequence constraint)
Called in the worker thread, filtered according to constraint. Returns the result, a Filterresults object that will be published in the UI thread through method Publishresults (Charsequence, Filterresults).
When the parameter (constraint) is null, revert to the initial data.
Method Two:
protected void Publishresults (charsequence constraint, filterresults results)
Called in the UI thread. The results of the Publish filter operation are displayed in the UI.
Android.widget.Filterable of Android API