I am using a Mocute-052 joystick to control my app. It uses Bluetooth
To handle the Joystick I look at the keycodes. The only way to avoid an app crash (without seeing any error logs), I need to use CallSubDelayed sub routines (as shown below)
When handling code directly under Activity_Keypress it causes crashes. Why??
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode=20 Or KeyCode=89 Then 'Joystick Down
CallSubDelayed(Me,"JOYSTICK_DOWN1")
Return True
End If
If KeyCode=19 Or KeyCode=90 Then 'Joystick Up
CallSubDelayed(Me,"JOYSTICK_UP1")
Return True
End If
Return True
End Sub