Hi,
I'm tying to intercept Volume UP and Down with this code (pretty well lifted straight off the forum)
but when I try to compile I get
I can't see anything wrong, but cannot get it to work!
No doubt its something simple, but not obvious (to me) - ANY IDEAS?
Thanks in advance Douglas
I'm tying to intercept Volume UP and Down with this code (pretty well lifted straight off the forum)
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
Log("Up")
Return True
End If
If ( KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN ) Then
Log("Down")
Return True
End If
End Sub
but when I try to compile I get
OR (depending on some factor that I don't understand?)Parsing code. Error
Error parsing program.
Error description: keycode is not a valid identifier.
Occurred on line: 51
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
Parsing code. Error
Error parsing program.
Error description: Input string was not in a correct format.
Occurred on line: 51
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
I can't see anything wrong, but cannot get it to work!
No doubt its something simple, but not obvious (to me) - ANY IDEAS?
Thanks in advance Douglas