title: Hide/Show Action Bar Option Menu Item for different fragments
body: <p>I have a Sherlock Fragment Activity in which there are 3 Fragments.</p>
  
  <p>Fragment A, Fragment B, Fragment C are three fragments. I want to show a done option menu in Fragment B only.</p>
  
  <p>And the activity is started with Fragment A. When Fragment B is selected done button is added.</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setHasOptionsMenu(true);
  }
  
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      if(!menusInflated){
          inflater.inflate(R.menu.security, menu);
          menusInflated=true;
      }
  
      super.onCreateOptionsMenu(menu, inflater);
  }
  </code></pre>
  
  <p>When I again start Fragment A I want to options Menu DONE (which was set at Fragment B) for this I am doing like this</p>
  
  <pre><code>setHasOptionsMenu(false);
  MenuItem item = (MenuItem) menu.findItem(R.id.done_item);
  item.setVisible(false);
  </code></pre>
  
  <p>But this is not hiding at all, also it is giving NullPointerException when Activity if first started with Fragment A.</p>
  
  <p>Please let me know what is the problem.</p>