FileDocCategorySizeDatePackage
CursorFilter.javaAPI DocAndroid 1.5 API2218Wed May 06 22:41:56 BST 2009android.widget

CursorFilter

public class CursorFilter extends Filter

The CursorFilter delegates most of the work to the 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);
        }