I have an Android application that has a search function that uses a ContentProvider to query the SQLite database that supports my application. As the user types in his query, the application provides special search suggestions described in the documentation for Android here .
In addition to this, I would like the search dialog to display a permanent option at the top of the user search suggestions, which, when selected, will perform web searches in the browser using a query (for example, "Search the Internet for xyz", or similar). The remaining suggestions will be the standard search suggestions of my ContentProvider.
Can this be done, and if so, how?
Edit:
David suggested solutions. I did something like this:
MatrixCursor cursor = new MatrixCursor(new String[] {BaseColumns._ID,
SearchManager.SUGGEST_COLUMN_TEXT_1});
cursor.addRow(new Object[] {0, "I'm always the top suggestion!"});
return new MergeCursor(new Cursor[] {cursor, mySearchSuggestionCursor});
source
share