I am developing an application for Android 4.0.3. I have multiple fragments and I have one menu item displayed on each of them. I want to have an overflow menu button that will have 2 menu items. How do I force the appearance of the overflow menu and add menu items to it ? I am adding menu items by calling the onCreateOptionsMenu function in each fragment.
Any and all help would be appreciated. Thanks!
To force into the overflow menu do this:
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
will force the item into either:Android 3.0 + : The ActionBar as an overflow Android 2.3 - : The menu button
If you are wanting to recreate the menu you will need to call
invalidateOptionsMenu();
This will re-create fromOnCreateOptionsMenu
.