Brian
Brian

Reputation: 8095

How do I open the Search interface?

I've been following the Searchable Dictionary example pretty carefully as I'm trying to implement the search functionality in my app. Right now I simply can't seem to get the Search interface to open when I press the search button. I've added the following into my manifest and searchable.xml resource into my res folder (which I pretty much copied from the example).

    <activity android:name=".main.SearchActivity"
              android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data android:name="android.app.searchable"
                   android:resource="@xml/searchable" />
    </activity>
    <meta-data android:name="android.app.default_searchable"
        android:value=".main.SearchActivity" />

What I'm not understanding is what else do I need to do to get this to work? Is there something I should have hard coded? Thanks a lot!

Upvotes: 0

Views: 312

Answers (1)

Brian
Brian

Reputation: 8095

Nevermind, I realized that in the searchable.xml, you can't use static strings, they have to be from the strings.xml resource. I just had to create search_label and search_hint and refer to them in the searchable.xml file. Here's the original article on that.

Upvotes: 1

Related Questions