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. It is used to filter out data that conforms to some type of 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 filter request in the request queue. Wait for processing. Cancels the last filter request that was not run.
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. Filter according to constraint. Returns the result, a Filterresults object that will be published in the UI thread through method Publishresults (Charsequence, Filterresults).
When the number of parameters (constraint) is null. reverts 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