For some reason, onCreateOptionsMenu() is called AFTER onResume() in my application ... Therefore, I just can not hold the menu while I adjust my interface (between onCreate() and onResume() ), which makes it impossible to set the corresponding elements actions for my ActionBar ...
The only thing I have found so far is to manually call invalidateOptionsMenu() just before returning onCreate() ; so that onCreateOptionsMenu() is called immediately, I get a menu hold, and then I can finally add the necessary elements.
Has anyone experienced this problem? How do you plan to programmatically configure your action items, data onCreateOptionsMenu() is called after onResume() ?
My application runs on JellyBean, it uses the built-in ActionBar (without ActionBarSherlock), android:minSdkVersion="14" and android:targetSdkVersion="16"
source share