Android Question How to suppress certain keystrokes?

ViMeAv ICT

Member
Licensed User
Longtime User
I have a hardware keyboard with a alpha button to select alpha or numerical keys.
I cannot see in which mode the keyboard is. (the switch is keycode 165)
But I have fields which have to be filled by only numbers and fields filled by only
alphas.
Now I use activity_keyup to see what button is pressed.
If I need a number and the keycode = 45, I change this into 7 and update the textfield.
Problem : You can see this on the screen.
In old VB you could use the keyup event to change the keycode, before printed on screen.
Or let the keycode die, keycode = 0.
Does android has an option like this?
Or simulate the pressing of the switch button?
 

Informatix

Expert
Licensed User
Longtime User
I have a hardware keyboard with a alpha button to select alpha or numerical keys.
I cannot see in which mode the keyboard is. (the switch is keycode 165)
But I have fields which have to be filled by only numbers and fields filled by only
alphas.
Now I use activity_keyup to see what button is pressed.
If I need a number and the keycode = 45, I change this into 7 and update the textfield.
Problem : You can see this on the screen.
In old VB you could use the keyup event to change the keycode, before printed on screen.
Or let the keycode die, keycode = 0.
Does android has an option like this?
Or simulate the pressing of the switch button?
The Masked EditText library can filter the characters before they are displayed. You can convert your keycodes easily with the Filter event.
 
Upvote 0
Top