title: android searchview setOnActionExpandListener on Honeycomb 3.2
body: <p>I'm developing an app for Android 3.2 and greater with <code>android-support-v4</code>. I need to implement <code>OnActionExpandListener</code> for "intercept" when SearchView in the actionbar is expanded and when is collapsed. My code for Android 4.0 and higher it's ok, but for 3.2 no.</p>
  
  <blockquote>
    <p>menu.xml</p>
  </blockquote>
  
  <pre><code>&lt;item android:id="@+id/menu_search"
      android:title="@string/menu_search"
      android:icon="@android:drawable/ic_menu_search"
      android:showAsAction="collapseActionView|always"
      android:actionViewClass="android.widget.SearchView" /&gt;
  </code></pre>
  
  <blockquote>
    <p>MyActivity.java</p>
  </blockquote>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.reader, menu);
  
      final MenuItem searchMI = menu.findItem(R.id.menu_search);
      if(searchView == null) {
          //searchView = (SearchView) searchMI.getActionView();
          searchView = (SearchView) MenuItemCompat.getActionView(searchMI);
          searchView.setOnQueryTextListener(this);
          searchView.setOnSuggestionListener(this);
          searchView.setOnCloseListener(new OnCloseListener() {
  
              @Override
              public boolean onClose() {
                  //some code
                  return false;
              }
          });
      }
  
  
      int currentapiVersion = android.os.Build.VERSION.SDK_INT;
      if (currentapiVersion &lt;= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) {
          MenuItemCompat.setShowAsAction(searchMI, MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
          MenuItemCompat.setOnActionExpandListener(searchMI, new OnActionExpandListener() {
  
              /* (non-Javadoc)
               * @see android.support.v4.view.MenuItemCompat.OnActionExpandListener#onMenuItemActionExpand(android.view.MenuItem)
               */
              @Override
              public boolean onMenuItemActionExpand(MenuItem item) {
                  Toast.makeText(getApplicationContext(), "onMenuItemActionExpand", Toast.LENGTH_SHORT).show();
                  return true;
              }
  
              /* (non-Javadoc)
               * @see android.support.v4.view.MenuItemCompat.OnActionExpandListener#onMenuItemActionCollapse(android.view.MenuItem)
               */
              @Override
              public boolean onMenuItemActionCollapse(MenuItem item) {
                  Toast.makeText(getApplicationContext(), "onMenuItemActionExpand", Toast.LENGTH_SHORT).show();
                  return true;
              }
          });
      } else {
          searchMI.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
  
              @Override
              public boolean onMenuItemActionExpand(MenuItem item) {
                  Toast.makeText(getApplicationContext(), "MenuItem#onMenuItemActionExpand", Toast.LENGTH_SHORT).show();
                  return true;
              }
  
              @Override
              public boolean onMenuItemActionCollapse(MenuItem item) {
                  Toast.makeText(getApplicationContext(), "MenuItem#onMenuItemActionExpand", Toast.LENGTH_SHORT).show();
                  return true;
              }
          });
      }
  }
  </code></pre>
  
  <p>Why, for Honeycomb, methods of listener is not invoked?</p>
  
  <p>Thank you so much.</p>