FileDocCategorySizeDatePackage
SuggestionProvider.javaAPI DocAndroid 5.1 API3610Thu Mar 12 22:22:12 GMT 2015android.app

SuggestionProvider

public class SuggestionProvider extends android.content.ContentProvider
Simple test provider that runs in the local process. Used by {@link SearchManagerTest}.

Fields Summary
private static final String
TAG
private static final int
SEARCH_SUGGESTIONS
private static final android.content.UriMatcher
sURLMatcher
private static final String[]
COLUMNS
Constructors Summary
public SuggestionProvider()


      
    
Methods Summary
private voidaddRow(android.database.MatrixCursor cursor, java.lang.String string)

        long id = cursor.getCount();
        cursor.newRow().add(id).add(string).add(Intent.ACTION_SEARCH).add(string);
    
public intdelete(android.net.Uri url, java.lang.String where, java.lang.String[] whereArgs)

        throw new UnsupportedOperationException("delete not supported");
    
public java.lang.StringgetType(android.net.Uri url)

        int match = sURLMatcher.match(url);
        switch (match) {
            case SEARCH_SUGGESTIONS:
                return SearchManager.SUGGEST_MIME_TYPE;
            default:
                throw new IllegalArgumentException("Unknown URL: " + url);
        }
    
public android.net.Uriinsert(android.net.Uri url, android.content.ContentValues initialValues)

        throw new UnsupportedOperationException("insert not supported");
    
public booleanonCreate()

        return true;
    
public android.database.Cursorquery(android.net.Uri url, java.lang.String[] projectionIn, java.lang.String selection, java.lang.String[] selectionArgs, java.lang.String sort)

        int match = sURLMatcher.match(url);
        switch (match) {
            case SEARCH_SUGGESTIONS:
                String query = url.getLastPathSegment();
                MatrixCursor cursor = new MatrixCursor(COLUMNS);
                String[] suffixes = { "", "a", " foo", "XXXXXXXXXXXXXXXXX" };
                for (String suffix : suffixes) {
                    addRow(cursor, query + suffix);
                }
                return cursor;
            default:
                throw new IllegalArgumentException("Unknown URL: " + url);
        }
    
public intupdate(android.net.Uri url, android.content.ContentValues values, java.lang.String where, java.lang.String[] whereArgs)

        throw new UnsupportedOperationException("update not supported");