title: How to set visibility for an actionbar menu group?
body: <p><strong>UPDATE</strong></p>
  
  <p>Originally I was using ActionBarSherlock I have since created a brand new project using a native android action bar just to test this and I am still getting the same problem.</p>
  
  <p>I am successfully showing/hiding items but not groups. I am rapidly coming to the conclusion that there is a bug in the ActionBar and it is not possible to programmatically set the visibility of a group</p>
  
  <p><strong>END of UPDATE</strong></p>
  
  <p>Given the following menu When accessing the Group I get a null pointer exception</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;item android:id="@+id/action_settings"
          android:title="@string/settings"
          android:orderInCategory="100"
          android:showAsAction="never"/&gt;
  
          &lt;group android:id="@+id/mnu_text_group"
             android:visible="false"&gt;
              &lt;item android:id="@+id/mnu_text_type"
                  android:enabled="true" 
                  android:visible="true"
                  android:icon="@drawable/ic_action_text_icon"
              android:showAsAction="always"&gt; 
              &lt;/item&gt;
              &lt;item android:id="@+id/text_color"
                  android:enabled="true" 
                  android:visible="true" 
                  android:showAsAction="always" 
                  android:icon="@drawable/ic_action_color_line"&gt;
              &lt;/item&gt;
          &lt;/group&gt;        
      &lt;item android:id="@+id/mnu_images"
  ...
  </code></pre>
  
  <p>In the onPrepareOptionsMenu of the relevant activity I have</p>
  
  <pre><code>public boolean onPrepareOptionsMenu(Menu menu) {
      MenuItem mnuTextGroup = menu.findItem(R.id.mnu_text_group);
      mnuImage.setEnabled(mEnableImageMenu);
      mnuTextGroup.setVisible(false);
      ...
  </code></pre>
  
  <p>The call to <code>mnuTextGroup.setVisible(false);</code> raises a null pointer exception</p>
  
  <p>However, by changing the find method to find an item within the group works fine e.g. <code>MenuItem mnuTextGroup = menu.findItem(R.id.mnu_text_type);</code>but obviously this works just for the specific item. I know groups are designed for exactly this purpose, to be able to set the visibility of and enable/disable all items within the group but I have been unable to find a way to do this programatically.</p>