Search code examples
androidandroid-edittextkeyboard-eventsrfid

RFID Reader Using OTG input


I am using OTG RFID Reader for Android. It's working fine in Edittext or Input text while swapping card.

Basically Micro USB RFID Reader which is Keyboard Interface.

So I wanted to know can i use this without Edittext.

I am currently doing Edittext using 1dp width and 1 dp for height, and transparent background as well as text color.

I am looking for some kind of service solution which give me data when io system recive data. That means before show to edit text.


Solution

  • You can capture any key event without having an EditText. You need to implement dispatchKeyEvent in your activity to capture each KeyEvent. You can then send them to a service in the background to be processed (for example send out an event when a full RFID is scanned or when the number of scanned events reach a certain number or however else you want to use them).

    dispatchKeyEvent documentation