title: Search Dialogue not activated when onSearchRequested is called (Android)
body: <p>Beginner working on an android app and I'm trying to start a searchable activity when the onSearchRequested method is called after a button push in the main activity. Currently, when the button is pressed, nothing happens. </p>
  
  <p>Here's MainActivity.Java: </p>
  
  <pre><code>package com.example.activity2;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  
  
  
  public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Button button1 = (Button) findViewById(R.id.button1);
          button1.setOnClickListener(new View.OnClickListener() 
          {
  
              @Override
              public void onClick(View v)
              {
                  onSearchRequested();
              }
          });
  
          }
  
      /** Called when the user clicks the Send button */
    //  public void sendMessage(View view)
     // {    
  
    //  }
  
  
  
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>Here's the manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.activity2"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-permission
           android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="19" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.SEARCH" /&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;action android:name="android.intent.action.FLAG_ACTIVITY_NEW_TASK" /&gt;
                  &lt;meta-data
                  android:name="android.app.default_searchable"
                  android:value="com.example.activity2.SearchActivity" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="com.authorwjf.youtubeapi.MainActivity"
              android:label="@string/title_activity_activity2" &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".SearchActivity" &gt;
              android:launchMode="singleTop" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.example.activity2.SEARCHACTIVITY" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT"  /&gt;
              &lt;/intent-filter&gt;
  
          &lt;/activity&gt;
          &lt;activity
              android:name=".OtherActivity"
              android:label="@string/title_activity_other" &gt;
  
              &lt;!-- enable the search dialog to send searches to SearchableActivity --&gt;
              &lt;meta-data
                  android:name="android.app.default_searchable"
                  android:value=".SearchActivity" /&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".SearchListView"
              android:label="@string/title_activity_search_list_view" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".SearchYoutube"
              android:label="@string/title_activity_search_youtube" &gt;
          &lt;/activity&gt;
          &lt;meta-data
                  android:name="android.app.searchable"
                  android:resource="@xml/searchable" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>SearchActivity.Java</p>
  
  <pre><code>package com.example.activity2;
  
  
  import java.util.ArrayList;
  import java.util.Iterator;
  
  import android.app.Activity;
  import android.app.SearchManager;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  import com.google.api.services.youtube.model.SearchResult;
  
  public class SearchActivity extends Activity {
      ListView lst;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_search_activity);
          Intent intent = getIntent();
          if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            ArrayList&lt;SearchResult&gt; results = new ArrayList&lt;SearchResult&gt;();
            Iterator&lt;SearchResult&gt; it = results.iterator();
            SearchYoutube.prettyPrint(it, query);
            lst = (ListView) findViewById(R.id.list);
            ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, SearchYoutube.ytstuff);
            lst.setAdapter(adapter);
      }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.search, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>