title: How do I pass extra variables during a search invoked by a SearchView/ Widget?
body: <p>I am successfully using a search widget in my action bar to perform a search following <a href="http://developer.android.com/guide/topics/search/search-dialog.html">this guide</a>. The search is fine, but I'm wondering how to pass additional variables on a search. The same guide states I can override <code>onSearchRequested()</code>, but this doesn't seem to work with a search widget.</p>
  
  <ul>
  <li><p>Override in question:</p>
  
  <pre><code>@Override
  public boolean onSearchRequested() {    
      Bundle appData = new Bundle();
      appData.putString("KEY", "VALUE");
      startSearch(null, false, appData, false);
      return true;
  }
  </code></pre></li>
  <li><p>Getting the bundle in my activity class:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      // ...
      Intent intent = getIntent();
      Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);
      String value = appData.getString("KEY");
      Log.d("VALUE", value);
      // ...
  }
  </code></pre></li>
  </ul>
  
  <p>My application crashes upon creating the search class because <code>appData</code> is always <code>null</code>.</p>
  
  <h3>Note</h3>
  
  <p><code>onSearchRequested()</code> <strong>is</strong> called, but the bundle does not make it to my <code>onCreate()</code> method.</p>
  
  <p>All extras from the passed intent are <code>{user_query=my-query, query=my-query}</code>.</p>