0

I posted a similar question: Android - How to disable Search button, how to implement onSearchRequested()? But at that time I was not very sure what I was looking for. But this time I'll be very specific.

What I am NOT looking for is: How I can use the dialog builder to disable the search button. This has been answered.

What I AM looking for is: How can I use the onSearchRequested() method to permanently disable the search button. Please take a look here http://www.youtube.com/watch?v=9lekcH1JAf0&feature=youtu.be for further elaboration.

In regards to this method, google states the following: "You can override this function to force global search, e.g. in response to a dedicated search key, or to block search entirely (by simply returning false)". Here is the link: http://developer.android.com/reference/android/app/Activity.html#onSearchRequested%28%29

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Noman Arain
  • 1,172
  • 4
  • 19
  • 45
  • Can you elaborate on the scope within which you wish to disable search? Just within your application, or on the device as a whole? What do you want to happen instead when the search button is pressed? – Phil Haigh Nov 19 '12 at 14:42

1 Answers1

0
@Override
public boolean onSearchRequested() {

    return true;//block search

}

if is not working have you tried this solution?:

https://stackoverflow.com/a/5461709/1552551

Community
  • 1
  • 1
BigBen3216
  • 868
  • 1
  • 8
  • 23