I have a Galaxy Nexus running 4.2.1 and I have no issues using oonSearchRequested
A few things to consider:
1 - Make sure you declare in your manifest that the searchable activity IS in fact searchable, and make sure you add the Search Intent Filter to catch onSearchRequested:
<activity
android:name="com.lazybits.rae.movil.Results"
android:label="@string/title_activity_results"
android:launchMode="singleTask"
android:parentActivityName="com.lazybits.rae.movil.Home" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
2 - Override onKeyDown()
to make a proper search interface:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_SEARCH) && isOkToSearchWithinTheApp) {
onSearchRequested();
return true;
}
return super.onKeyDown(keyCode, event);
}
At this point if you have a searchWidget it should be loaded automatically, and you are now just waiting on user input. You would want to override onNewIntent
for handling the search via Action.Search or Action.View depending on your searchable.xml behaviour.
EDIT
OK, can you do me a favor, and simply try to override onKeyDown, but not put any code in it, like this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
//do nothing, simply return true to avoid regular behavious
return true;
}
}
What I want to test, is to see if that will stop Google now from coming up, this should do absolutely nothing. If that works, then afterwards you can add your code, just make sure you return true (to avoid further propagation of the event), and that you don't call onSearchRequested.