Android bluetooth keyboard input


#1

I have ported a simple player I use from windows to android. I have a blue tooth input device that emulates an HID keyboard. So the app simply listens for keyboard inputs like ‘P’ for play ‘S’ for stop etc. This works great on windows. But on android I cant seem to get the input. If I save a file using the file chooser I can input the file name with the blue tooth device so I know this can work. But I get no input to the component. Is this a focus issue so the input is going somewhere else? (I’m new at this android stuff)

I don’t know how to force open a soft keyboard to test that way either.

Mark.


#2

More Info.

If I open a file browser, the dialog will normally open the soft keyboard. But if the blue tooth device is connected the soft keyboard does not open. I assume this means the app knows the device is connected.

I added a label showing input so I can see if I get anything. The keyListener never calls keyPressed. There must be someone out there that knows how android input works…


#3

I finally got it to work. I added these lines in the mainwindow constructor:
setBroughtToFrontOnMouseClick(true);
toFront(true);
Not sure if they are both necessary but it works. Seems like by default it should have focus on start up so it does not seem like I should need to do this.

Mark