I'm implementing my own SearchRecentSuggestionsProvider
and everything's working except one thing: I can't get the device search to display icons for the results. I'd like to display images from my application's data folder (located at /{sdcard}/Android/data/package_name/files/
)
According to the documentation, it's achievable by using SearchManager.SUGGEST_COLUMN_ICON_1
, and it apparently supports a number of schemes, including ContentResolver.SCHEME_FILE
, which is file
. Here's a quote from the official docs:
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
)
I've tried a number of obvious things, including manual creation of the file URI and automated creation using Uri.Builder()
. None of this worked.
I also found someone else asking about the same thing on Google Groups, and it's sadly unanswered: https://groups.google.com/forum/#!topic/android-developers/MJj7GIaONjc
Does anyone have any experience in getting the device search to display local images from the device?
UPDATE (December 15):
I've just tried using the ContentProvider
with a SearchView
as the searchable info, and it works exactly as expected - including the cover art images. Still, global search doesn't show it...