Android search dialog

Lately I was developing a search dialog in my android application.
I read very good documentation at android cental.

I did almost everything according to the manual, but I had problem with receiving intent from Search Dialog in my searchable activity. I did everything to register it correctly but it received no intents at all.

After some time I learned that you need to be very precise when editing searchable.xml.
Content of this file was looking like this:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="search_label"
android:hint="search_hint" >
</searchable>

See any bugs? No... So did I :)
It seems that Android don't like letting this values to be hardcoded.
I needed to change this into:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint" >
</searchable>

After that everything worked great :)

Recent comments