Android.widget.Filterable of Android API

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.