title: onCreateOptionsMenu called after onResume on JB 4.2
body: <p>I have the following fragment in my application:</p>
  
  <pre><code>public class MyFragment extends SherlockListFragment implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
    private MenuItem refresh = null;
  
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      setHasOptionsMenu(true);
  
      //.....
  
      // NPE here
      refresh.setActionView(R.layout.indeterminate_progress_action);
      getActivity().getSupportLoaderManager().initLoader(0, null, this);
    }
  
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      inflater.inflate(R.menu.refresh_menu, menu);
      refresh = (MenuItem) menu.findItem(R.id.menu_item_refresh);
    }
  
    @Override
    public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {
      mAdapter.swapCursor(data);
      refresh.setActionView(null);
    }
  }
  </code></pre>
  
  <p>Basically when the user starts the Activity I want to display a progress spinner, in the actionbar, until the loader completes. Prior to Android 4.2 everything worked fine. On Android 4.2 I get the following error:</p>
  
  <pre><code>11-24 13:37:14.811: E/AndroidRuntime(17850): Caused by: java.lang.NullPointerException
  11-24 13:37:14.811: E/AndroidRuntime(17850):    at com.MyApp.library.fragments.MyFragment.onActivityCreated(TabFragment.java:65)
  </code></pre>
  
  <p>After adding some break point I realized onCreateOptionsMenu was getting called after onActivityCreated.  Is there another life cycle event I can use?  Is there a better was to achieve the desired effect?</p>