Android Question Catch keycodes of lowercase and uppercase separately

Meigionel TS

Member
Licensed User
I am looking for a way to catch keyUp events when a key is pressed. In the B4A constants it appears that KeyCodes like KEYCODE_F captures both, "f" and "F" keys together, but I am looking for a way to detect KeyCode for "f" and "F" separately.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code:
B4X:
Sub Activity_KeyDown(Keycode As Int, KeyEvent As Object)
   Dim jo As JavaObject = KeyEvent
   Dim c As Int = jo.RunMethod("getUnicodeChar", Null)
   If c > 0 Then
       Log(Chr(c))
   End If
End Sub

#if Java
public boolean _onkeydown (int keyCode, android.view.KeyEvent event) {
   processBA.raiseEvent(null, "activity_keydown", keyCode, event);
   return false;
}
#End If
 
Upvote 0

Similar Threads

Top