Android Question Keyboard Key Capture/Change

adriano.freitas

Active Member
I have an old application made in B4A only. I still don't have a way to migrate to XPages, but I need help making a change.

I need to capture certain keys pressed on the virtual keyboard and convert them to others, for example, whenever the user presses the A key, process it as if it were the B key.

I would like this to occur throughout the entire application, regardless of the control that has focus.

Any solution?

Thanks!
 

teddybear

Well-Known Member
Licensed User
I have an old application made in B4A only. I still don't have a way to migrate to XPages, but I need help making a change.

I need to capture certain keys pressed on the virtual keyboard and convert them to others, for example, whenever the user presses the A key, process it as if it were the B key.

I would like this to occur throughout the entire application, regardless of the control that has focus.

Any solution?

Thanks!
See here whether it is you want ?
 
Upvote 0

adriano.freitas

Active Member
See here whether it is you want ?

Thank you for attention

Almost that. The problem is that this way I can only capture special keys, like the back key, volume key, etc. When I refer to the A and B keys I speak literally. If the person uses the A key on the soft keyboard, I need the application to process it as if it were the B key and so on.
 
Upvote 0

Spavlyuk

Active Member
Licensed User
The problem is that this way I can only capture special keys, like the back key, volume key, etc
Afaik, the method shown captures all keys that are not handled by a view. A focused EditText for example, handles alphanumeric characters, as well as some other keys and in those cases the event is not raised. There's no easy to modify they key before it reaches the focused view.

Perhaps alternatively, you could use a custom keyboard: https://www.b4x.com/android/forum/threads/b4x-sd-customkeyboard.138438/
 
Upvote 0
Top