Hi, I`m connecting B4A to a BT selfie stick and monitoring the key presses (code shown below), but with several keys it returns the correct value but then followed by 5 zero`s. This is making my life hard to detect the keypress, would appreciate any idea`s to help this?
Here is the log:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Activity_KeyPress(10)
Camera
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(11)
Video
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(66)
Shutter Button clicked
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(25)
Zoom -
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(25)
Zoom -
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(25)
Zoom -
Here is the log:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Activity_KeyPress(10)
Camera
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(11)
Video
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(66)
Shutter Button clicked
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(0)
Activity_KeyPress(25)
Zoom -
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(25)
Zoom -
Activity_KeyPress(24)
Zoom +
Activity_KeyPress(25)
Zoom -
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event
Log($"Activity_KeyPress(${KeyCode})"$)
If KeyCode = 25 Then
Log("Zoom -")
Return True
End If
If KeyCode = 24 Then
Log("Zoom +")
Return True
End If
If KeyCode = 11 Then
Log("Video")
Return True
End If
If KeyCode = 10 Then
Log("Camera")
Return True
End If
If KeyCode = 66 Then
Log("Shutter Button clicked")
Return True
End If
End Sub