Android検索可能な辞書の結果は、グローバル検索に示されていません

StackOverflow https://stackoverflow.com/questions/4001625

  •  25-09-2019
  •  | 
  •  

質問

検索可能な辞書サンプルアプリを実装しようとしました。グローバル検索の結果を引き出しようとする場合を除いて、すべてが機能しているようです。私はドキュメントで説明されているすべてのものにも従おうとしました。

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

何が問題なのでしょうか?

ありがとう、達成

役に立ちましたか?

解決

すべてが順調でしたが、検索結果に検索可能な辞書を表示するように検索設定を明示的に構成しませんでした。それを追加すると、すべてが正常に機能しました。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top