Here is how I did it:

Put this in your AndroidManifest.xml:
<activity
    android:name=".SearchLaunchActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
>
    <intent-filter>
        <action android:name="android.intent.action.SEARCH_LONG_PRESS" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>


Then just create your class.  In my case it is called
SearchLaunchActivity.java and it extends Activity.  All it does in my case
is launch another activity, which is why I chose the theme that I did.  I
also included a setting in my app to allow the user to turn this behavior on
or off so that having my app installed does not bug them if they don't want
to launch my app from the search bar.

If you want to see it in action, you can download "AppSwipe!" and "AppSwipe!
Donate Key"  The donate key is $0.99 but you can try it for 24 hours and
request a refund... The search button launch is disabled in my free app.
The key unlocks this functionality.

Thanks,
Justin
MagouyaWare Developer


----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Sun, Nov 8, 2009 at 12:58 AM, allandroid <[email protected]> wrote:

> Hi, if i want to write an app (activity?) that gets called when the
> user presses the search key whether or not my app is running, how do i
> do that?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to