-3

I am trying to develop an android keyboard that is controlled by an external hardware signal. The touchscreen will not work. The external hardware will act like the TAB key on windows, advancing to next keyboard key on a single signal received. Two signals in a row would be the selection of the key. I've been looking to SoftKeyboard exemple but couldn't figure out where to start from there.

I was thinking about this two options: 1) Create a keyboard based on IME and add a cursor that steps to every key position (x, y) on screen. 2) Create a keyboard based on android UI with buttons.

Any suggestions? What do you think it would be the best practice?

Thanks

1 Answers1

0

Just use a mouse. Plug the mouse into the usb port (may need an adapter depending on the device) and a mouse magically appears.


If your device acts like an HID keyboard: Override the dispatchKeyEvent(KeyEvent event) method in your activity.

int id = event.getDeviceId();
if (id > 0) {
    //Then the device is a physical keyboard
    //Now you just have to decide what to do
}

As you can see from this example, you receive key events. From there you can decide what to do. Once you figure out the location of a something you want to touch you can dispatch an event using the dispatchTouchEvent of the activity.

Randy
  • 4,351
  • 2
  • 25
  • 46