Note that there are some explanatory texts on larger screens.

plurals
  1. POSearchable Configuaration Returning Null For the SearchView
    primarykey
    data
    text
    <p>I have created a search interface but I can't seem to connect the <code>SearchView</code> in the <code>ActionBar</code> to my searchable configuration file. When I try to retreive it in my <code>onCreateOptionsMenu</code> method <code>SearchManager.getSearchableInfo(getComponentName()</code> returns null. Could someone help me out with this?</p> <p><strong>Settings.onCreateOptionsMenu(Menu)</strong></p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_main, menu); SearchManager sm = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView sv = (SearchView) menu.findItem(R.id.menu_search).getActionView(); SearchableInfo info = sm.getSearchableInfo(getComponentName()); //This variable is returned as null sv.setSearchableInfo(info); sv.setIconifiedByDefault(false); sv.setSubmitButtonEnabled(true); return true; } </code></pre> <p><strong>Settings Activity in AndroidManifest.xml</strong></p> <pre><code>&lt;activity android:name=".Settings" android:label="@string/app_name" android:screenOrientation="portrait" &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.searchable" android:resource="@xml/searchable" /&gt; &lt;/activity&gt; </code></pre> <p><strong>Searchable Activity in AndroidManifest.xml</strong></p> <pre><code> &lt;activity android:name=".ImageSearch" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.SEARCH" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>I have the header <code>&lt;?xml version="1.0" encoding="utf-8"?&gt;</code> in my menu xml file and I tried cleaning the project. None of them seem to do the trick.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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