title: Null pointer exception in searchview
body: <p>I am trying to create list search view in shreyaloclistfragment. I am getting NullPointerException at folowing line</p>
  
  <pre><code>final SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
  </code></pre>
  
  <p>My method is </p>
  
  <pre><code>@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater ) {
      super.onCreateOptionsMenu(menu, inflater);
      inflater.inflate( R.menu.menu_search, menu);
      System.out.println( "inflating menu");
  
      final SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
  
  
  
      final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {
              showFilteredItems( newText );
              return true;
          }
  
          @Override
          public boolean onQueryTextSubmit(String query) {
              return true;
          }
      };
  
      searchView.setOnQueryTextListener(queryTextListener);
  
      return;
  }
  </code></pre>
  
  <p>Stack trace </p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.NullPointerException
  at com.sears.syw.FragmentShopsTab.onCreateOptionsMenu(FragmentShopsTab.java:52)
  at android.support.v4.app.Watson.onCreatePanelMenu(Watson.java:55)
  at  
  
  
  com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:559    )
  at   
  
      com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSh    erlockNative.java:65)
  at 
  </code></pre>