Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your problem is in your AndroidManifest. I had it almost exactly as you do, because that is what I get following the documentation. But it is unclear or mistaken.</p> <p>Watching at the API Demos source I found that the "android.app.searchable" metadata must go in your "results" activity, and in the main activity (or the activity where you place the SearchView) you point to the other one with "android.app.default_searchable".</p> <p>You can see it in the following file, which is the Manifest from my test project:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/title_activity_main" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.app.default_searchable" android:value=".SearchActivity" /&gt; &lt;/activity&gt; &lt;activity android:name=".SearchActivity" android:label="@string/app_name" &gt; &lt;!-- This intent-filter identifies this activity as "searchable" --&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.SEARCH" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;!-- This metadata entry provides further configuration details for searches --&gt; &lt;!-- that are handled by this activity. --&gt; &lt;meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>It is also important that the hint and label in the searchable.xml are references, and not hardcoded strings.</p> <p>I hope it solves your problem. It took me all day to figure it out :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload