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.2Im 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
精彩评论