SearchInfo always coming out null
<p>I'm having trouble setting up the search view in the action bar.</p>

<p>I followed the developer site, but it doesn't work. I get the feeling that I am missing something.</p>

<p>When I run my code, it always outputs "failed to get searchable info" (MainActivity.setupSearchView()).</p>

<p>EDIT: I redid the project again and it seemed to work. I'm not sure what the problem was.</p>

<p>MainActivity.java</p>

<pre><code>// package...
// imports...
public class MainActivity extends Activity {
    private static String tag = "Main Activity";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater mi = getMenuInflater();
        mi.inflate(R.menu.search_view, menu);
        setupSearchView(menu);
        return true;
    }
    private void setupSearchView(Menu menu) {
        SearchManager sm = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchableInfo si = sm.getSearchableInfo(getComponentName());
        if (si == null) {
            Log.wtf(tag, "failed to get searchable info");
            return;
        }
        SearchView sv = (SearchView) menu.findItem(R.id.menu_search).getActionView();
        sv.setSearchableInfo(si);
        // Do not iconify the widget; expand it by default
        sv.setIconifiedByDefault(false);
    }
}
</code></pre>

<p>SearchResultsActivity.java</p>

<pre><code>// package...
// imports...
public class SearchResultsActivity extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final Intent queryIntent = getIntent();
        doSearchQuery(queryIntent);
    }
    @Override
    public void onNewIntent(final Intent newIntent) {
        super.onNewIntent(newIntent);
        final Intent queryIntent = getIntent();
        doSearchQuery(queryIntent);
    }
}
</code></pre>

<p>searchable.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:hint="@string/search_hint"
    android:label="@string/search_label" &gt;
&lt;/searchable&gt;
</code></pre>

<p>AndroidManifest.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="kpaek.examples"
    android:versionCode="1"
    android:versionName="1.0" &gt;
    &lt;uses-sdk android:minSdkVersion="15" /&gt;
    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
        &lt;activity
            android:name=".search.MainActivity"
            android:label="@string/app_name" &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;/activity&gt;
        &lt;activity
            android:name=".SearchResultsActivity"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.SEARCH" /&gt;
            &lt;/intent-filter&gt;
            &lt;meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" /&gt;
        &lt;/activity&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>EDIT:
I redid the project again and it seemed to work.
I'm not sure what the problem was.</p>
