startSearch not working
I have the following code in onSearchRequest
public boolean onSearchRequested() {
startSearch(开发者_开发问答"HI", false,null,true);
return true;
}
This is working bt uses default google search. If I use
startSearch("HI", false,null,false);
then search dialog doesn't open...
Any reason for that?
This is the manifest file
<activity android:name=".search"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.default_searchable"
android:value=".SearchableActivity" />
</activity>
<activity android:name=".SearchableActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
AFAIK, you need to add search service in the AndroidManifest. Check http://developer.android.com/guide/topics/search/search-dialog.html for more information.
精彩评论