title: How do I open the SearchView programmatically?
body: <p>There is this widget for the ActionBar which called 'SearchView'.
  When it's not in use, it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/X63B4.png" alt="enter image description here"></p>
  
  <p>And when it's in use, it looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/vEtc1.png" alt="enter image description here"></p>
  
  <p>I want (programmatically of course) to open the searchview (make it "in use").</p>
  
  <p>I tried several functions such as:</p>
  
  <pre><code>SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
      searchView.setOnQueryTextListener(this);
  
      searchView.performClick();
      searchView.requestFocus();
  </code></pre>
  
  <p>But none of those worked...</p>
  
  <p>The SearchView in the XML:</p>
  
  <pre><code>&lt;item android:id="@+id/menu_search"
        android:title="Search"
        android:icon="@drawable/ic_action_search"
        android:showAsAction="ifRoom|collapseActionView"
        android:actionViewClass="android.widget.SearchView" /&gt;
  </code></pre>