Detect input from software or hardware keyboard

I am working on an Android application that needs to use an RFID tag reader. I use this reader as an additional device connected to my microUSB with an OTG wire. Android detects this device as input keyboard. I would like to know if I can programmatically detect when the user is making input with this reader. So basically I have to distinguish the input from my software keyboard or this reader. I've searched a lot but I can't seem to find a solution and any help would be so much appreciated. Thank you very much.

0


source to share


1 answer


yourEditText.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            return false;
        }
    });

      

This will determine if your editText will be edited using the hardware keyboard.



As stated here , this is only useful for the hardware keyboard, so in your case, if this interface is not called, it means the editText input must be from the software keyboard.

+1


source







All Articles