Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Options menu?
Started by joerijacobs Jul 13 2013 09:10 AM

7 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

joerijacobs

[GLOBAL: userInfoPane.html]
joerijacobs
  • Observer

  • 17 posts
  • Corona SDK

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.



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,896 posts
  • Enterprise

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.



[TOPIC: post.html]
#3

joerijacobs

[GLOBAL: userInfoPane.html]
joerijacobs
  • Observer

  • 17 posts
  • Corona SDK

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



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,896 posts
  • Enterprise

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.



[TOPIC: post.html]
#5

joerijacobs

[GLOBAL: userInfoPane.html]
joerijacobs
  • Observer

  • 17 posts
  • Corona SDK

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



[TOPIC: post.html]
#6

joerijacobs

[GLOBAL: userInfoPane.html]
joerijacobs
  • Observer

  • 17 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#7

JonPM

[GLOBAL: userInfoPane.html]
JonPM
  • Corona Geek

  • 1,077 posts
  • 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.  



[TOPIC: post.html]
#8

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

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.




[topic_controls]
[/topic_controls]