0
我试图实现searchable字典示例应用程序。 除非我尝试从全局搜索中获取结果,否则一切似乎都正常。 我试图遵循文档中描述的所有内容。android全局搜索中未显示搜索字典结果
我searchable.xml
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:searchSettingsDescription="@string/settings_description"
android:searchSuggestAuthority="sd2.com.achie.DictionaryProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://sd2.com.achie.DictionaryProvider/dictionary"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1"
android:includeInGlobalSearch="true"
>
</searchable>
和当局MIME类型
public static String AUTHORITY = "sd2.com.achie.DictionaryProvider";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/dictionary");
public static final String WORDS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE +"/vnd.sd2.com.achie";
public static final String DEFINITION_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE +"/vnd.sd2.com.achie";
我的清单是
<!-- Receives the search request. -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<!-- No category needed, because the Intent will specify this class component-->
</intent-filter>
<!-- Points to searchable meta data. -->
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<!-- Displays the definition of a word. -->
<activity android:name=".WordActivity"
android:theme="@android:style/Theme.NoTitleBar" />
<!-- Provides search suggestions for words and their definitions. -->
<provider android:name=".DictionaryProvider"
android:authorities="sd2.com.achie.DictionaryProvider" />
<!-- Points to searchable activity so the whole app can invoke search. -->
<meta-data android:name="android.app.default_searchable"
android:value=".SearchableDictionary" />
可能是什么问题?
谢谢 的政绩
当您尝试从全局搜索中提取结果时会发生什么? – 2010-10-23 02:09:28
它不显示字典中的结果。我看不到我要出错的地方如果你想检查 – achie 2010-10-23 07:14:54
,我可以把整个代码发布到某个地方试图从全局搜索中抽取某些东西的代码在哪里? – 2010-10-25 17:43:55