快速搜索框

时间:2011-12-11 12:56:56

标签: android android-layout

我正在尝试为qsb实现自定义建议。我添加了CREATE TABLE IF NOT EXISTS suggestion_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, suggest_text_1 VARCHAR(50),suggest_intent_data INTEGER)作为建议表。 intent.getDataString()的输出仅为content://com.simple.search.SuggestionProvider/tests。我真的很困惑。我认为它会给出suggest_intent_data的价值。如何从suggest_intent_data

获取列intent的内容
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
    Log.d(Tag.getTag(this), (intent.getDataString()));
    };

来自http://developer.android.com/guide/topics/search/adding-custom-suggestions.html

  

定义内部每个建议的数据   建议表的SUGGEST_COLUMN_INTENT_DATA列。

     

为每个意图提供所有必要的数据信息   通过包含SUGGEST_COLUMN_INTENT_DATA列的建议表   然后使用每行的唯一数据填充它。来自的数据   此列与您在此中定义的完全相同   柱。然后,您可以使用getData()或   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=" ?"
    />

0 个答案:

没有答案
相关问题