rokoder

Android missing MENU button

by on Jan.13, 2012, under Programming

Well since ICS, h/w MENU button is having a life of uncertainty on a phone. It may or may not be present. I learnt that the hard way, so thought of sharing this with everyone who is in the same boat. And some times (which sometimes becomes often) Android sdk docs are not very thorough (but yeah they are on the right track and doing better now). Here we ll consider two scenarios:

Scenario 1: App does not use standard title bar but have menu options

If you have a app (for Android api level less than 11) with MENU options but you are hiding the the title bar either to support your own toolbar or your app needs to be full screen (and dont want to use Action Bar for backward compatibility), and you want it to work fine on devices like Galaxy Nexus which do not have h/w MENU button), then make sure ‘targetSDKVersion’ is set to ¬†less than 11 or better dont set it if you dont need to.


    
    

Once done your application should see a three dotted overflow menu button at the bottom navigation bar like:

Navigation Bar on devices not having h/w MENU button with legacy app support

Navigation Bar on devices not having h/w MENU button with legacy app support

NOTE: BTW if you set the ‘targetSdkVersion’ to higher than 10 and not using Action bar (say you are by hiding it) then even this 3 dot icon in navigation bar will be missing and there is no way to access menu on devices which lack h/w MENU button.

Scenario 2: App does use standard title bar and have menu options

If you have a app (for Android api level less than 11) with standard title bar and using menu options, and you want to make it work fine on new devices which support Action bar (to have forward compatiblity), then make sure ‘targetSDKVersion’ is set to ¬†11 or higher.

This is generally set to enable some features by default. Like your legacy app uses legacy title bar and standard MENU options so setting ‘targetSdkVersion’ to ’11′ will enable Holo theme if you are NOT setting it in your app and also will enable Action bar. Here you dont have to worry about no h/w MENU button as overflow menu button will be shown in the Action bar as:

Action bar overflow MENU button

Action bar overflow MENU button

Hope it help you get started quickly on ICS and above. I just covered the missing part, pls refer for more info Action Bar and Menus.

:,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...

Archives

All entries, chronologically...