tstanly wrote:
> hi all,
> 
> I want to change the search/query key on phone by application code,
> so I use the keyevent, the code is:
> ===========================================
> public boolean onKeyDown(int keyCode, KeyEvent event) {
>         if (keyCode == KeyEvent.KEYCODE_SEARCH) {
>             //do what you want
>         System.out.println("this is key SEARCH!");
>     }
>         return true;
> }
> ===========================================
> but when I press the search button,
> there are nothing to change and no message on the logcat,
> so, is possiable to change search/query button by application code?

For your activity, yes. See here for a project that does this:

http://github.com/commonsguy/cw-advandroid/tree/master/Camera/Picture/

If you are looking to change the behavior for the entire device, the
best you can do is try to create an activity that responds to
ACTION_SEARCH -- the user *might* be prompted to choose between your
application and the built-in search system. I have not tried this and do
not know how well it will work, if at all.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to