thesaurus & dictionary > Support > Dictionary ContentProvider Custom Suggestions


User Post
Ray K
3 post(s)


I'm working on an app that uses the English Dictionary - Offline content provider to do word lookups. I have a search widget and I'm trying to do custom suggestions for word completion (,

I can do my own partial match query with the "content://livio.pack.lang.en_US.DictionaryProvider/search_suggest_query" URI, but I'm having trouble integrating into the android search interface. I've added the following to my searchable.xml: android:searchSuggestAuthority="livio.pack.lang.en_US.DictionaryProvider" to enable the suggestions, but I get the error:

Invalid int: "search_suggest_query"

Which seems like the URI format is not what the search interface is expecting. Any help on how I can hook this up?


28-Sep-13, 2:40:36 Rispondi | Citazione | Report spam
134 post(s)

Web site
Please post your question on stackoverflow providing source code fragments to detail your application. After you post the question on stackoverflow send me an email with the link to the post.

29-Sep-13, 9:20:14 Rispondi | Citazione | Report spam
Ray K
3 post(s)

I'm not sure if this question belongs on stackoverflow, since it's very specific to your dictionary app and the ContentProvider. Is it the code formatting you're worried about? There honestly isn't much relevant code to share, since I've basically just followed the guides that I linked in the first post. I'll try to detail my process better, and provide some code.

I put together a search interface that looks exactly like the standard one detailed here

But then when I want to add search suggestions to the interface (as per, which requires me to provide a ContentProvider to the search interface, I give it yours like so in my searchable.xml:

    android:searchSuggestThreshold="2" />

And then I think the search view should automatically be populated with the suggested words as I start to type them in, but instead I get the error:

09-29 10:59:22.260: W/SuggestionsAdapter(13051): java.lang.IllegalArgumentException: Invalid int: "search_suggest_query"

And I know that "search_suggest_query" is part of the URI you use for partial matches, but I'm wondering if it's not what the android search api is expecting.

So my question is: is it possible to use your ContentProvider with the android search interface?

I noticed that your dictionary apps have suggestions associated with their search fields, and I'm basically trying to do the same thing, so I figured it would be possible by simply providing your ContentProvider to the search interface, so that's what I tried to do.

Sorry if this is the wrong place to be posting this. I just figured since it's so specific to your app this was the right place.

29-Sep-13, 20:05:30 Rispondi | Citazione | Report spam
134 post(s)

Web site
The content provider in my dictionary has to be accessed as described in the "Dictionary Provider" section of this website:

The query is performed by using getContentResolver().query(uri, null, null, selectionArgs, null)

Please note that selectionArgs has to be set with a value (null is not applicable to selectionArgs).

19-Oct-13, 13:06:59 Rispondi | Citazione | Report spam