title: SearchView with Toolbar inside Fragment
body: <p>I am using <code>SearchView</code> with <code>Toolbar</code> inside fragment and i want to register for <code>SearchView.OnQueryTextListener</code> interface so that i can get callback when user perform search. </p>
  
  <p>I am inflating the menu with <code>Toolbar</code> as (inside <code>onCreateView</code>):</p>
  
  <pre><code>mToolbar = (Toolbar) v.findViewById(R.id.toolbar);
  mToolbar.inflateMenu(R.menu.menu_main);
  mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
      @Override
      public boolean onMenuItemClick(MenuItem item) {
          onOptionsItemSelected(item);
          return false;
      }
  });
  </code></pre>
  
  <p>Inflating the menu this way does not call <code>onCreateOptionMenu</code> method and normally we register for the callback in that method as:</p>
  
  <pre><code>@Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          super.onCreateOptionsMenu(menu, inflater);
          inflater.inflate(R.menu.menu_main, menu);
          mGoTodayMenuItem = menu.findItem(R.id.action_go_to_today);
          mSearchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
  
          SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
          mSearchView.setQueryHint("Search");
          mSearchView.setSearchableInfo(searchManager
                  .getSearchableInfo(getActivity().getComponentName()));
          mSearchView.setOnQueryTextListener(this);
      }
  </code></pre>