title: Adding SearchView in Fragment
body: <p>Trying to include a searchview in actionbar. For this, I have done the following:</p>
  
  <p>Created MenuSearch.xml in the menu folder as given below:</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/action_search"
      android:actionViewClass="Android.Support.V7.Widget.SearchView"
      android:icon="@android:drawable/ic_menu_search"
      android:showAsAction="always"
      android:title="Search"/&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>Included the method OnCreateOptionsMenu in the fragment:</p>
  
  <pre><code>public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
      {
          inflater.Inflate(Resource.Menu.MenuSearch, menu);
          base.OnCreateOptionsMenu(menu, inflater);
          var searchManager = (SearchManager) this.Activity.GetSystemService(Context.SearchService);
          searchView = (SearchView) (menu.FindItem(Resource.Id.action_search).ActionView);
          searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));
  
      }
  </code></pre>
  
  <p>And I have set <code>HasOptionsMenu = true;</code> in oncreate of the fragment.</p>
  
  <p>With the code above, I get null pointer in the line <code>searchView.SetSearchableInfo...</code> . Not sure why this happens, though everything seem to be correct and in place.</p>
  
  <p>Based on some suggestions for resolving similar issue, I have also tried out the below option for searchview.</p>
  
  <pre><code>        var item = menu.FindItem (Resource.Id.action_search);
          var searchItem = MenuItemCompat.GetActionView(item);
          searchView = searchItem.JavaCast&lt;Android.Support.V7.Widget.SearchView&gt;();
          searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));
  </code></pre>
  
  <p>But again, I get searchView as null.</p>
  
  <p>Now that I have tried the possible options, I am clueless as to why searchview becomes null. </p>
  
  <p>Any help is much appreciated.</p>