Android Question Android phone Device menu key location

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
We can detect if the android mobile device has soft keys or hard keys by this code:

B4X:
Sub HasPermanentMenuKey As Boolean
  Dim r As Reflector
  If r.GetStaticField("android.os.Build$VERSION", "SDK_INT") >= 14 Then
  r.Target = r.RunStaticMethod("android.view.ViewConfiguration", "get", _
  Array As Object(r.GetContext), Array As String("android.content.Context"))
  Return r.RunMethod("hasPermanentMenuKey")
  End If
  Return True
End Sub

The Question is about the menu key (not home nor back keys):
How can we specify the location of the menu key? (soft or hard menu key) Is it in upper left, upper right, lower left or lower right corner ?
 

DonManfred

Expert
Licensed User
Longtime User
How can we specify the location of the menu key? (soft or hard menu key) Is it in upper left, upper right, lower left or lower right corner ?
1. You can´t change it´s position.
2. You SURELY cant´s change the Position of Hardwarebuttons as you can not change the Hardware by code.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Same code based on JavaObject:
B4X:
Sub HasPermanentMenuKey As Boolean
  Dim vc As JavaObject
  Dim context As JavaObject
  context.InitializeContext
  vc = vc.InitializeStatic("android.view.ViewConfiguration").RunMethod("get", Array(context))
  Return vc.RunMethod("hasPermanentMenuKey", Null)
End Sub

About your question, assuming that targetSdkVersion in the manifest editor is set to 14+ then there will only be a 3 dots button if there is no hard menu key. If the button is visible then it will be in the top right corner.
 
Upvote 0
Top