I have a SearchManager installation where a drop-down list of offers will be displayed by user type. Results are received from my server (http). I would like to display an icon with each option (if the file actually exists).
Looking at the documents, I see that the parameters for the constant column SUGGEST_COLUMN_ICON_1 allow the use of the following parameters:
Column name for suggestions cursor. Optional. If your cursor includes this column, then all suggestions will be provided in a format that includes space for two small icons, one at the left and one at the right of each suggestion. The data in the column must be a resource ID of a drawable, or a URI in one of the following formats: content (SCHEME_CONTENT) android.resource (SCHEME_ANDROID_RESOURCE) file (SCHEME_FILE)
All I have is a URL. Which option is best for me?
Here is the class where I do this:
public class MyCustomSuggestionProvider extends SearchRecentSuggestionsProvider { public static final String AUTHORITY = "---.MyCustomSuggestionProvider"; public static final int MODE = DATABASE_MODE_QUERIES; private final static String[] COLUMN_NAMES = {BaseColumns._ID, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_QUERY, SearchManager.SUGGEST_COLUMN_INTENT_DATA, SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA, SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_INTENT_ACTION}; public MyCustomSuggestionProvider() { setupSuggestions(AUTHORITY, MODE); } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor recentCursor = super.query(uri, projection, selection, selectionArgs, sortOrder); String query = selectionArgs[0]; if (query == null || query.length() < 3) { return recentCursor; } final MatrixCursor customCursor = new MatrixCursor(COLUMN_NAMES);
android url uri android-searchmanager search-suggestion
Kickinglettuce
source share