title: How to remove MenuItems from Menu programmatically?
body: <p>I'm developing some Android application, and I've got some code for menu:</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item
          android:showAsAction="ifRoom"
          android:id="@+id/menuItemToLeft"
          android:icon="@drawable/to_left" /&gt;
      &lt;item
          android:showAsAction="ifRoom"
          android:id="@+id/menuItemToRight"
          android:icon="@drawable/to_right"/&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>I use "showAsAction" in order to show this items on Action Bar. Also I've got 3 tabs for navigation. But there is the following task: remove (or set visibility as false) this items from Action bar when tab with 0 positions is selected.  But I don't understand how I can do it:</p>
  
  <pre><code>public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
      mViewPager.setCurrentItem(tab.getPosition());
      if (tab.getPosition()==0) {
      //some code
      }
  }
  </code></pre>