title: android search widget menu item
body: <p>I use this code as <a href="http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget" rel="nofollow">this Android API Guides</a> suggest to have a search widget in android 3.0 or more:</p>
  
  <pre><code>   @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the options menu from XML
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.options_menu, menu);
  
      // Get the SearchView and set the searchable configuration
      SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
      searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
  
      return true;
  }
  </code></pre>
  
  <p>I have declared search menu item (and other menu item) in res/menu/menu.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:id="@+id/help"
          android:icon="@android:drawable/ic_menu_help"
          android:title="Help" 
          /&gt;
      &lt;item android:id="@+id/menu_search"
          android:icon="@android:drawable/ic_menu_search"
          android:title="Search" 
          android:showAsAction="ifRoom"
      /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>I also created an activity for search results and its res/xml/searchable.xml settings, as API Guides suggest.
  But as I start my app i get a <code>NullPointerException</code> at<code>onCreateOptionsMenu</code>and at <code>onCreatePanelMenu</code></p>