开发者

Is there a way to catch the Search key so that the Google Voice Search dialog doesn't appear?

开发者 https://www.devze.com 2023-01-19 15:16 出处:网络
I\'m aware that the home key cannot be caught, and I\'m worried that a long-press on the Search key is another \"Android-OS protected\" key press.Just for testing, I tried to catch all keys with this

I'm aware that the home key cannot be caught, and I'm worried that a long-press on the Search key is another "Android-OS protected" key press. Just for testing, I tried to catch all keys with this code within my Activity, but it does not stop the Google Voice Search dialog from being triggered.

@Override
public boolean dispatchKeyEvent(KeyEvent event)
{
    return true;
}

Edit: I tested this code on the Nexus One, and it successfully blocks the key event on that phone, but I still have this prob开发者_JAVA百科lem on the Droid 2. Both are running Froyo 2.2


Im not at my pc, so im just gonna paste a search result.

I think you'r looking for this:

Activity | Android Developers boolean, onSearchRequested(). This hook is called when the user signals the desire to start a search. http://developer.android.com/reference/android/app/Activity.html

0

精彩评论

暂无评论...
验证码 换一张
取 消