Результаты поиска в словаре android не отображаются в глобальном поиске - PullRequest
0 голосов
/ 23 октября 2010

Я попытался реализовать пример приложения для поиска по словарю.Кажется, все работает, за исключением тех случаев, когда я пытаюсь извлечь результаты из глобального поиска.Я также пытался следовать всему, что было описано в документации.

Мой 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>

И власти, пантомимы

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" />

В чем может быть проблема?

Спасибо, Ачи

1 Ответ

1 голос
/ 07 декабря 2010

все было хорошо, но я не настраивал параметры поиска в явном виде для отображения словаря с возможностью поиска в результатах поиска. Как только я добавил это, все работало нормально.

...