How to have onSearchRequested not open a web browser.

Posted by pcm2a on Stack Overflow See other posts from Stack Overflow or by pcm2a
Published on 2010-06-06T03:11:06Z Indexed on 2010/06/06 3:12 UTC
Read the original article Hit count: 349

Filed under:

I have a button in my app. When it is pressed I call the onSearchRequested() method. When this is called the stock search box comes up so the user can type some junk in there. When they press "Go" I need the results returned back to my application but instead the stock browser is opened and a google search is performed. How can I tell it to return the results to my application instead.

I've tried these items in my manifest.xml file:

<meta-data android:name="android.app.default_searchable"
android:value=".MainActivity" />

<activity android:name=".MainActivity"
android:launchMode="singleTop"

<intent-filter>
<action android:name="android.intent.action.SEARCH" />                         
</intent-filter>

I've also tried to capture the result in my onCreate with this:

Intent intent = getIntent();        
if (Intent.ACTION_SEARCH.equals(intent.getAction())) 

© Stack Overflow or respective owner

Related posts about android