Removing Rogue Menus (Or, Why Targeting 14 Might Be Necessary)

Those of you rocking Honeycomb or Ice Cream Sandwich devices that lack an off-screen MENU button have no doubt seen various apps that display the … overflow menu affordance, but nothing happens when you tap on it:

Navigation area, targetSdkVersion of 10

You will get that effect on apps that have their android:targetSdkVersion set to 10 or lower. The normal solution is to bump that to at least 11, in which case the affordance vanishes, except if the overflow area is needed, in which case it appears in the action bar.

However, not all devices behave this way. For example, the HTC One S has off-screen HOME, BACK, and RECENT buttons, but no off-screen MENU button. You would expect that a target of 11 would suffice to remove the on-screen overflow menu affordance… and you would be mistaken. Instead, a navigation area at the bottom of the screen will be solely such an affordance:

Navigation area, targetSdkVersion of 11

The solution is to raise the android:targetSdkVersion to 14 or higher. This eliminates the navigation area entirely when it is not needed on an HTC One S.

Bear in mind, though, that setting your target that high will also have other effects, notably causing your AsyncTasks to be serialized by default.

Learn second-generation Android app development — with Kotlin and the Android Jetpack — through CommonsWare’s Android app development training!