'In page where keycodes need to be captured.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
'    Root.LoadLayout("page2")
    Dim ghostView As EditText
    ghostView.Initialize("ghostView")
    Root.AddView(ghostView, 0, 0, 0, 0)
    
    Sleep(50)
    ghostView.RequestFocus
    CallSub2(Main, "showKB", ghostView)
    
    'if you want to hide the keyboard
    'CallSub(Main, "hideKB")
End Sub
Private Sub ghostView_TextChanged(old As String, new As String)
    Log(new.charAT(new.length-1))
End Sub