title: How to refresh Action Bar menu in fragments
body: <p>I am using the onCreateOptionsMenu to display the action bar Sherlock menu in fragment. I have a requirement such that if a list is null then make menu to be disable and if present then enable and some options in menu to be changed.
  This is my code</p>
  
  <pre><code>public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      if ((list != null &amp;&amp; list.size() &gt; 0)
              || (response != null &amp;&amp; response.messageInfo != null &amp;&amp; response.messageInfo
                      .size() &gt; 0)) {
          SubMenu submenus = menu.addSubMenu("");
          submenus.add(1, 1, 1, "Send New Message");
          submenus.add(1, 2, 2, "Filter by Category");
          MenuItem subitem = submenus.getItem();
          subitem.setIcon(R.drawable.img_sorting);
          subitem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      } else {
          menu.add(1, 10, 10, "NOT Clickable").setIcon(R.drawable.img_hide)
                  .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
      }
  }
  </code></pre>
  
  <p>So here when it loads for the first time it is in disable even when the list is there its still in disable mode until if I refresh it is not changing its properties.</p>