I'm having some success with generating/dispatching key events to an
EditText field.  The major malfunction comes in when I try to generate
a character that requires a META key.  I can't get capital letters to
work, nor will any ALTed chars work.  I'm sure there is something
fundamental I'm not understanding, and was hoping someone could help.

Using this constructor:
   KeyEvent(long downTime, long eventTime, int action, int code, int
repeat, int metaState);

I am using this code to successfully generate a 'w' in the EditText
field:
   KeyEvent event = KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_W, 0, 0);
   event.dispatch(edit_text_field_1);

But now when I change the metaState:
   KeyEvent event = KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_W, 0, KeyEvent.META_SHIFT_ON);
   event.dispatch(edit_text_field_1);

I expected a capital 'W' to appear, but still got the small 'w'.


Similarly, I was trying to get a question mark '?' out of this
(since ? is "alt comma");
   KeyEvent event = KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_COMMA, 0, KeyEvent.META_ALT_ON);
   event.dispatch(edit_text_field_1);

But I get the comma.

So really the question is, how can I use this construct/dispatch
KeyEvent technique to generate capital letters
and ALTed chars?

Thanks!!    -Wes

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

Reply via email to