title: Android - How to disable Search button, how to implement onSearchRequested()?
body: <p>Checked out the following:
  <a href="https://stackoverflow.com/questions/5215541/how-to-have-clicking-the-phones-search-button-do-nothing">How to have clicking the phone&#39;s search button do nothing?</a></p>
  
  <p>But it does not work for me. Anybody has any other suggestions? Thank you.
  Following Phil's suggestion updating the code according to his answer.
  Shows the bug <a href="http://www.youtube.com/watch?v=9lekcH1JAf0&amp;feature=youtu.be" rel="nofollow noreferrer">http://www.youtube.com/watch?v=9lekcH1JAf0&amp;feature=youtu.be</a></p>
  
  <p>So I have made a sample project. I have tested this on two different phones, Android version 2.3.5 and 4.1, I also tested this on emulator version 2.2. After I click the button show dialog, it shows the progress dialog just fine, and it should continue to do so. But clicking the Search button on the phones and the emulator makes the progress dialog disappear. Here's the class, and manifest follows. </p>
  
  <p>Current behavior is that when the search button is clicked the progress dialog disappears.
  Expected or needed behavior is to disable the search button, or similarly when the dialog is being shown and the search button is clicked, this click does not make the dialog disappear.</p>
  
  <pre><code>    package com.example.test6;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  public class MainActivity extends Activity {
  
      Button showDialogButton;
      Context context;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          showDialogButton = (Button) findViewById(R.id.showDialogButton);
          showDialogButton.setOnClickListener(showDialog);
          context = this;
          startSearch(null, false, null, false);
      }
  
      private OnClickListener showDialog = new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              ProgressDialog progressDialog = new ProgressDialog(context);
              progressDialog.show();
          }
      };
  
      @Override
      public boolean onSearchRequested() {
         Log.d("onSearchRequested", "search key pressed");
         return false;
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  }
  
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.test6"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="1"
          android:targetSdkVersion="15" /&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="Test6" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.SEARCH" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
          &lt;meta-data
              android:name="android.app.searchable"
              android:resource="@xml/searchable" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>My searchable xml is at: res/xml/searchable.xml according to the reference provided. This is how my searchable.xml looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;searchable xmlns:android="http://schemas.android.com/apk/res/android"
      android:searchSuggestAuthority="dictionary"
      android:searchSuggestIntentAction="android.intent.action.VIEW"
      android:includeInGlobalSearch="true"&gt;
  &lt;/searchable&gt;
  </code></pre>