I’m trying to implement custom suggestions for qsb. I have added CREATE TABLE IF NOT EXISTS suggestion_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, suggest_text_1 VARCHAR(50),suggest_intent_data INTEGER) as suggestions table. The output of of intent.getDataString() is only content://com.simple.search.SuggestionProvider/tests. I’m real confused here. I thought it would give the value of suggest_intent_data. How can I get the content of column suggest_intent_data from the intent?
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Log.d(Tag.getTag(this), (intent.getDataString()));
};
From http://developer.android.com/guide/topics/search/adding-custom-suggestions.html
Define the data for each suggestion inside the
SUGGEST_COLUMN_INTENT_DATA column of your suggestions table.Provide all necessary data information for each intent in the
suggestions table by including the SUGGEST_COLUMN_INTENT_DATA column
and then populating it with unique data for each row. The data from
this column is attached to the intent exactly as you define it in this
column. You can then retrieve it with with getData() or
getDataString().
searchable.xml
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:hint="@string/search_hint"
android:label="@string/app_label"
android:searchSuggestAuthority="com.simple.search.SuggestionProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://com.simple.search.SuggestionProvider/tests" //yeah, I thought this was causing the problem too. But after removing this line no change.
android:searchSuggestThreshold="1"
android:searchSuggestSelection=" ?"
/>
I was not selecting
suggest_text_1suggest_intent_datafrom the table while performing query. Adding those fixed it.