1

When a user presses the Search hard key on the device, Android shows the Quick Search Bar. How do I disable the Quick Search Bar?

animuson
  • 52,378
  • 28
  • 138
  • 145
Mudassir
  • 14,250
  • 8
  • 62
  • 86

2 Answers2

2

In order to completely disabled the Quick Search Bar, override the method onSearchRequested()and return true unconditionally.

Mudassir
  • 14,250
  • 8
  • 62
  • 86
1

override onKeyDown in your activity:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_SEARCH) {            
        return true;
    } else return super.onKeyDown(keyCode, event);
}
Mathias Conradt
  • 28,117
  • 20
  • 135
  • 191
  • 1
    Thanks buddy. But I have found a better solution. I have overridden the method onSearchRequested() and returned true from there. – Mudassir Oct 27 '10 at 03:05