Disable Menu

Cableguy

Expert
Licensed User
Longtime User
My app has currently only one layout....by the use of a menuItem I turn a scrollview visible and then when user hits the back button I override it and tur the scrollview bac to invisible...I setted a flag to know what is in the Foreground being shown to the user...
I need to make the menu disabled while the scrollview is visible, how can I achieve this?
 

Cableguy

Expert
Licensed User
Longtime User
You can also create a custom menu and show it when the user presses on the menu button by catching the KeyPress event.

I didnt thought of that, good one EREL, thanks
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I hope it is ok to tag on to this question. (I was going to write the same subject)

I have the following

B4X:
Sub Activity_Keypress (KeyCode As Int) As Boolean
Dim Answ As Int
Dim Txt As String
Log(KeyCode)

If KeyCode=KeyCodes.KEYCODE_BACK Then
   Txt = "Do you really want to Quit the Program ?"
   Answ=Msgbox2(Txt,"ATTENTION","Yes","","No",Null)
   If Answ=DialogResponse.POSITIVE Then
      Return False
   Else
      Return True
   End If
End If

end sub

But it only works for 2 items on the standard menu. I put a pause on the log statement but it only pauses on the KEYCODE_BACK and the
Keycode that = 82 ' (Calls the Menu)
the other 2 just act as normal

is there a way to catch those keypresses?

thanks

Joe
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Thx for the reply Erel,

They are listed as the recent apps key and the Home Key

Joe
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Menu Options

Hello All,

I need to do this as well. I don't care to overwrite the Home key, which on this device is a physical key. I am wanting to show full screen video in a VideoView. I set it to full screen and it shows full screen but the menu icons are there in the bottom of the video. The back, SDCard Icon, Menu Icon, etc. I don't need to trap or turn off any functions I just want to turn them to where they are not visiable and showing in the video. I know it can be done because the gallery viewer that came on the device shows full screen videos and the softkeys are not there unless you tap the screen. Is there a way to do this in B4A?

Thanks,

Margret
 
Last edited:
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I know it can be done because the gallery viewer that came on the device shows full screen videos and the softkeys are not there unless you tap the screen

I saw this on the device before buying and i too thought it might be possible
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I assume that you must be talking about Android 3.0 or later. This code in Activity_Resume will do it, Btn1 can be any View in the activity. However the manifest minSdkVersion must be set to 11 or higher for this to be recognised and the manifest set read-only. Doing this will alter the look of your UI elements (to the point of unusability on my Xoom :()

B4X:
   Dim Obj1 As Reflector
   Obj1.Target = Btn1
   Obj1.RunMethod2("setSystemUiVisibility", 1, "I")
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
softkeys off

I assume that you must be talking about Android 3.0 or later. This code in Activity_Resume will do it, Btn1 can be any View in the activity. However the manifest minSdkVersion must be set to 11 or higher for this to be recognised and the manifest set read-only. Doing this will alter the look of your UI elements (to the point of unusability on my Xoom :()

B4X:
   Dim Obj1 As Reflector
   Obj1.Target = Btn1
   Obj1.RunMethod2("setSystemUiVisibility", 1, "I")

The device I was talking about is running a forked version of Android 2.2. Through more than one stock app on the device, the softkeys go invisiable until you tap the screen. This happens in the picture viewer and in the video viewer. There is also a drawing app in the app store that I downloaded and it does the same, so it can be done, I just wish I knew how.
 
Last edited:
Upvote 0
Top