SuggestionProviderpublic 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 void | addRow(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 int | delete(android.net.Uri url, java.lang.String where, java.lang.String[] whereArgs)
throw new UnsupportedOperationException("delete not supported");
| public java.lang.String | getType(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.Uri | insert(android.net.Uri url, android.content.ContentValues initialValues)
throw new UnsupportedOperationException("insert not supported");
| public boolean | onCreate()
return true;
| public android.database.Cursor | query(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 int | update(android.net.Uri url, android.content.ContentValues values, java.lang.String where, java.lang.String[] whereArgs)
throw new UnsupportedOperationException("update not supported");
|
|