Using the Android Menu button

Andras

Active Member
Licensed User
Longtime User
No doubt a foolishly easy question, but no sign of this in the Guide that I can see (which probably means I've used the wrong search terms) but:

How do I access the Android Menu button - the one on the device, not one created in the program?

Thanks!

John
 

cmweb

Active Member
Licensed User
Longtime User
Just create your menu entries with

Activity.AddMenuItem

or

Activity.AddMenuItem2

If the user pushs the hardware menu button, your menu entries will appear.

Best regards,

Carsten
 
Upvote 0

Penko

Active Member
Licensed User
Longtime User
And depending on what you have specified in the "eventName" argument, you will get the event like thisprovided that I have used "Menu" as my argument value.

B4X:
Sub Menu_Click
    Dim txt As String
    
    txt = Sender
    
    Select txt
    Case "Toggle Set"
      ' some logic
    Case "Settings"
               ' some other logic
      StartActivity(zPreferenceActivity.screen.CreateIntent)
    End Select
End Sub
 
Upvote 0

mhdi

Member
Licensed User
Longtime User
Hi all,

How can I detect if someone presses menu button once or holds it down for a long press?

Menu button press -> Do something
Menu button long press -> Do something else

I'm talking about the physical button on device.

Thankyou
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
Hi there,

There is a config or properties options on the menu in several applications that I want to have on my apk

For example, firefox or the stock browser on Android 4 has a menu (3 dots) that when clicked open the menu options and i have the config option.

It seems to me that there is a standard presentation of the config options, taking for base these 2 browsers.

How is it called? Is there a tutorial/example of creating it?

Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…