I want my application to present the default menu button within my Galaxy nexus. However when I load my app it removes the menu button. I have tried programmatically to show the menu button: first it tried the OnCreateOptionsMenu but it doesnt run when my activity is being created. Then I tried to run the openOptionMenu() within the onCreate method of my activity but no good.
Asked
Active
Viewed 3,020 times
1
-
If what you mean is that you want to show the menu, then you may find the answer in this possible duplicate question: http://stackoverflow.com/questions/3133318/how-to-open-the-options-menu-programmatically – Jimbali Jul 15 '12 at 14:12
-
What is your target SDK? I think anything under 4.0 will show a menu button whether it is used or not. Google are trying to stop people from depending upon the menu button. – TomRichardson Jul 15 '12 at 14:13
-
On the other hand if it's the actual menu button you want to display, this possible duplicate may help: http://stackoverflow.com/questions/8897763/android-show-menu-button-on-galaxy-nexus – Jimbali Jul 15 '12 at 14:21
-
– MrBug Jul 15 '12 at 14:28
-
In my question I meant to show the button that if I press it the menu will be opened. the posts i saw just tell me how to open the menu , but not how to show the button which opens the menu. – MrBug Jul 15 '12 at 14:30
-
code example would be appreciated – MrBug Jul 15 '12 at 14:50
1 Answers
2
I want my application to present the default menu button within my Galaxy nexus
I am uncertain what "the default menu button" is.
If you have android:minSdkVersion
or android:targetSdkVersion
set to 11 or higher, the overflow menu button will appear on the right side of your action bar.
In most other scenarios, you should get the legacy menu button in the bottom navigation bar.
For more, please read this Android Developers Blog post.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
The weirdest thing about this is that: i can see this overflow menu button in some activities of my app, but in the main activity it shows up for less than a second, when it starts ,and then disappears completely – MrBug Jul 16 '12 at 05:36
-
@CommonsWare I thought that you have to set targetSdkVersion to 13 if you want the menu button to show on Honeycomb+ devices. It works for my Galaxy Nexus (running JB), however it doesn't work on my Google Nexus 7 (running JB). Go figure... – IgorGanapolsky Dec 03 '12 at 16:30
-
@IgorG.: AFAIK, it is the other way around -- you can't get *rid* of the legacy MENU affordance unless you target 14 or higher. http://commonsware.com/blog/2012/06/08/removing-rogue-menus.html – CommonsWare Dec 03 '12 at 16:54
-
1Alright, just so we are clear - if I set the target to 13 then I won't see a menu button on the Nexus 7. Only on Galaxy Nexus. That is a fact. I had to set the target to 10 in order to get the menu button to show on the Nexus 7. – IgorGanapolsky Dec 03 '12 at 18:42
-
@IgorG.: Then either implement an action bar or do not use options menus. You will not be able to stick with that `targetSdkVersion` value for all that long -- something is going to crop up in some release that is going to force your hand to specify a higher value. – CommonsWare Dec 04 '12 at 12:07
-
This is unbelievable how the Android designers mess it all up. The menu button was a good idea. Instead of the menu button now "show all working apps" button is shown. This functionality could be called after long press on the Home key. To me - really frustrating and stupid. – Yar Dec 11 '12 at 19:23