Sunday, November 6, 2011

Re: [android-developers] Compound Component not getting onKeyDown onKeyListener events for Droid Bionic or X2

On Sat, Nov 5, 2011 at 9:03 AM, Eric Carman <ewcarman23@gmail.com> wrote:
Based on this, I can see that the onKey... events for the component is only being reached for events like Menu and Back. The individual key events for the character presses are not being triggered. According to the users, the keyboard is not prompting them for word choices as they enter characters on their keyboards. I thought perhaps the keyboard was in some state like you might find when typing a text message. 

This is confusing.  If you are using onKeyDown() etc to interact with the IME, you are relying on the backwards compatibility behavior where the view is not implementing the real InputConnection protocol but relying on the IME to send simulated hard key events to it.  This has never allowed for a full interaction with IME, and I don't think it has ever allowed for completion choices because you are not giving it a way to show candidate text and such as the user interacts with the keyboard.

If you want a full interaction with an IME, you really should implement the InputConnection protocol.  The easiest way to do this is with TextView (it is definitely a lot more complicated than getting raw simulated hard key press events), but you can implement it yourself.

At the very least, you need to make sure you implement http://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo) to tell the IME the type of text editing it should do for your view by filling in the EditorInfo.  The http://developer.android.com/reference/android/view/inputmethod/BaseInputConnection.html is provided to help with implementing an InputConnection.

--
Dianne Hackborn
Android framework engineer
hackbod@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate