FileDocCategorySizeDatePackage
CursorFilter.javaAPI DocAndroid 5.1 API2275Thu Mar 12 22:22:56 GMT 2015android.support.v4.widget

CursorFilter

public class CursorFilter extends android.widget.Filter
The CursorFilter delegates most of the work to the {@link android.widget.CursorAdapter}. Subclasses should override these delegate methods to run the queries and convert the results into String that can be used by auto-completion widgets.

Fields Summary
CursorFilterClient
mClient
Constructors Summary
CursorFilter(CursorFilterClient client)

        mClient = client;
    
Methods Summary
public java.lang.CharSequenceconvertResultToString(java.lang.Object resultValue)

        return mClient.convertToString((Cursor) resultValue);
    
protected FilterResultsperformFiltering(java.lang.CharSequence constraint)

        Cursor cursor = mClient.runQueryOnBackgroundThread(constraint);

        FilterResults results = new FilterResults();
        if (cursor != null) {
            results.count = cursor.getCount();
            results.values = cursor;
        } else {
            results.count = 0;
            results.values = null;
        }
        return results;
    
protected voidpublishResults(java.lang.CharSequence constraint, FilterResults results)

        Cursor oldCursor = mClient.getCursor();
        
        if (results.values != null && results.values != oldCursor) {
            mClient.changeCursor((Cursor) results.values);
        }