views:

23

answers:

1

I'm making great progress porting my Color Computer Emulator to Android. It works on a Droid 2 with a hardware keyboard but I'm unable to get the virtual keyboard to send KeyEvents to my SurfaceView subclass. I've included the setFocusable(true), setFocusableInTouchMode(true), requestFocus() and requestFocusFromTouch() in the View per suggestions here. The onKeyUp and onKeyDown methods are not being called when using the virtual keyboard. I tried (although I'm not completely certain it's necessary) implementing onCreateInputConnection and returning a new BaseInputConnection (along with the corresponding onCheckIsTextEditor) without success.

I'm using an HTC Incredible for testing. Any help or sample code would be appreciated.

Thanks.

A: 

The problem was entirely in the emulation code. When using a virtual keyboard the key down event is immediately followed by a key up clearing my key array before the emulation could handle the result. This doesn't happen with a real keyboard (no matter how fast I type). I only discovered this after I found a blog on how to use the dev usb driver with the HTC Incredible.

Brad Grier