Options menu?

Hi, 

Is it possible in Corona SDK to create an options menu. I mean an menu that pops up when you touch the hardware button of a smartphone. I searches for it on google but i can’t find something about it.

what do you mean “hardware button”?  On android, we can deal with “back”, “volumeUp” and “volumeDown”.  On iOS there is no buttons to catch.  Usually you would have a “gear” icon with a touch handler on it to bring up your settings screen.

I mean on android the hardware button (the button on the device) with the 3 stripes vertically aligned. I don’t mean settings, i mean a options menu, see the image.

android-2-2-4.jpg

First of all, not all devices have that button.  Let me ask the engineers, but I’ve only seen reference to Back, VolUp and VolDown.

i’m sure that 70 - 80% of the android devices (phones) have that button.

If it don’t exist i think it will be a good idea to implement that in a next big update of the corona sdk. 

Most Android devices have either the hardware Menu button or a soft Menu button (personally I have never seen one without it).  However, Google has been trying to get away from that and instead use the Action Bar.   I’m not sure if someone has made the equivalent, but I would love to see Corona create an API for this.  

Corona can detect when the option menu button has pressed via a “key” event.  The key name is “menu”.

   http://docs.coronalabs.com/api/event/key/keyName.html

Note that Rob is actually correct.  Most modern “Google sanctioned” Android device no longer have a “physical” menu button.  Nor a physical “search” button.  Google has been deprecating support of the physical menu button as of Android 3.0 as documented via the link below.  They want you to show menu options in a toolbar instead, such as via their ActionBar if you were doing native development.

   http://developer.android.com/guide/topics/ui/menus.html

On Android 3.0 and higher devices, I believe the virtual menu button only shows up on the bottom navigation bar if your app is set up to run in legacy mode.  That is, it must target Android 2.3 or lower, which you don’t want to do and we’re not interested in supporting because you wouldn’t be able to take advantage of all of the newest Android OS features.

Regarding the ActionBar, that is an Android 3.0 or higher feature only.  There is zero support for it on older Android versions, such as 2.3, which is still a significant portion of the market.  Because of this, I don’t think it’s worth investing our time into.  Especially since we’re more focus on providing cross-platform support between Android *and* iOS.

So, my recommendation is to go ahead and support the Menu key event, but also make sure to have a virtual menu button within your own apps for those devices that do not have a physical/virtual menu button.  Odds are, you need something like this on iOS as well, because it doesn’t have a physical menu button.

Anyways, I hope this helps.

what do you mean “hardware button”?  On android, we can deal with “back”, “volumeUp” and “volumeDown”.  On iOS there is no buttons to catch.  Usually you would have a “gear” icon with a touch handler on it to bring up your settings screen.

I mean on android the hardware button (the button on the device) with the 3 stripes vertically aligned. I don’t mean settings, i mean a options menu, see the image.

android-2-2-4.jpg

First of all, not all devices have that button.  Let me ask the engineers, but I’ve only seen reference to Back, VolUp and VolDown.

i’m sure that 70 - 80% of the android devices (phones) have that button.

If it don’t exist i think it will be a good idea to implement that in a next big update of the corona sdk. 

Most Android devices have either the hardware Menu button or a soft Menu button (personally I have never seen one without it).  However, Google has been trying to get away from that and instead use the Action Bar.   I’m not sure if someone has made the equivalent, but I would love to see Corona create an API for this.  

Corona can detect when the option menu button has pressed via a “key” event.  The key name is “menu”.

   http://docs.coronalabs.com/api/event/key/keyName.html

Note that Rob is actually correct.  Most modern “Google sanctioned” Android device no longer have a “physical” menu button.  Nor a physical “search” button.  Google has been deprecating support of the physical menu button as of Android 3.0 as documented via the link below.  They want you to show menu options in a toolbar instead, such as via their ActionBar if you were doing native development.

   http://developer.android.com/guide/topics/ui/menus.html

On Android 3.0 and higher devices, I believe the virtual menu button only shows up on the bottom navigation bar if your app is set up to run in legacy mode.  That is, it must target Android 2.3 or lower, which you don’t want to do and we’re not interested in supporting because you wouldn’t be able to take advantage of all of the newest Android OS features.

Regarding the ActionBar, that is an Android 3.0 or higher feature only.  There is zero support for it on older Android versions, such as 2.3, which is still a significant portion of the market.  Because of this, I don’t think it’s worth investing our time into.  Especially since we’re more focus on providing cross-platform support between Android *and* iOS.

So, my recommendation is to go ahead and support the Menu key event, but also make sure to have a virtual menu button within your own apps for those devices that do not have a physical/virtual menu button.  Odds are, you need something like this on iOS as well, because it doesn’t have a physical menu button.

Anyways, I hope this helps.