4

I created an app with minimum SDK 7 in order to get maximum compatibility with circulating devices. On Android phones (GB2.3), pressimng Menu button pops up a menu strip on the bottom of the screen, and that is correct.

However on HC3.2 tablets, where no menu hardware key is present, I expected a soft-menu key on the bottom of the screen, but it didn't appear, so I can't open my menu.

I don't know where to investigate and which portion of my code to share, so could you please show me where do I have to look for menu softbutton?

After reading that menus are deprecated in most recent Android versions, I don't know if ICS4 has a soft-menu button or not. I never tested my app on such a device. Can you give me advices?

Thanks

usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
  • 1
    what is the target SDK ? and did you have title bar ? – Selvin Apr 03 '12 at 10:25
  • Target SDK is 11. Title bar intentionally disabled – usr-local-ΕΨΗΕΛΩΝ Apr 03 '12 at 10:28
  • what is the style defined for activity ... i just did quick test and i have menu soft button on my 3.2 device ... http://selvin.pl/hc32menu.jpg ... – Selvin Apr 03 '12 at 10:48
  • @Selvin I think you mean android:theme="@android:style/Theme.Light.NoTitleBar"? – usr-local-ΕΨΗΕΛΩΝ Apr 03 '12 at 10:51
  • 1
    "Target SDK is 11. Title bar intentionally disabled" -- do one or the other, not both. As it stands, you will never have a menu on Android tablets, ever. – CommonsWare Apr 03 '12 at 11:53
  • Do you mean I should lower target SDK? – usr-local-ΕΨΗΕΛΩΝ Apr 03 '12 at 14:46
  • Well, I mean do one or the other. :-) If you hide the action bar, 3.x/4.x tablet users cannot access your "action overflow" (a.k.a., options menu). Phone users *may* be able to access it, if the device has a off-screen MENU button, which may mostly be 2.x devices being upgraded. Targeting a lower SDK is a tactical choice -- eventually, *something* is going to force your hand to target 11+. – CommonsWare Apr 03 '12 at 14:55

1 Answers1

0

The link you provide tells you how to correctly provide action bars in your app so that the presence or otherwise of a physical menu button is irrelevant, so that's a good start.

Now, you need to combine that with a little runtime detection of the SDK version (just check the Build.VERSION.SDK_INT constant for Android 1.5 or above), along with some appropriate reflection to enable the same APK to run on any Android version starting with your minSDK version.

RivieraKid
  • 5,923
  • 4
  • 38
  • 47
  • Thanks for your answer. I hope there is a simpler solution because I would like to maintain the same appearence and code throughout different versions. Since I do currently use soft-menu in HC3.2 I don't see any reason to abandon it (yet) – usr-local-ΕΨΗΕΛΩΝ Apr 03 '12 at 10:54
  • 2
    I agree its good to try to maintain the same appearance as it reduces confusion among your users, but you may want to reconsider that with such fundamental UI elements as you may increase confusion if your app deviates too much from the user's platform look and feel. – RivieraKid Apr 03 '12 at 11:06
  • 1
    "I would like to maintain the same appearence... throughout different versions" -- this matters to you, not to the vast majority of your users. The vast majority of your users do not have *both* an Android 2.x and an Android 3.0+ device. Users want consistency between apps they use, not between the same app on devices they do not own. Your rationale is akin to those who say their Android app must look identical to their iPhone app, despite significant navigational differences between those devices. – CommonsWare Apr 03 '12 at 11:56
  • @CommonsWare thanks for having highlighted my design fault. +1 – usr-local-ΕΨΗΕΛΩΝ Apr 03 '12 at 14:47