You need to set the MetaState flags of the KeyEvent for the comma to
META_SHIFT_ON.

However, I strongly discourage injecting key events if at all possible since
it tends to be brittle.

For example, you are probably assuming that shift-, produces < but there is
no guarantee that the keymap will be defined that way.

Jeff.

On Feb 17, 2011 12:31 PM, "Ankur Avlani" <[email protected]> wrote:
>
> Hi All,
>
> I am trying to Manually dispatch Shift and Comma key from Android to my
webview, my code is as follows:
>
> KeyEvent event1 = new
KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT);
> boolean isFlag = dispatchKeyEvent(event1);
> KeyEvent event2 = new
KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_COMMA);
> dispatchKeyEvent(event2);
> KeyEvent event3 = new
KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_SHIFT_LEFT);
> dispatchKeyEvent(event3);
> But the issue is, its sending the key one by one, i want it to send
"Shift," key event to webview.  Any ideas what needs to be corrected?.  I
tried googling, but couldnt find any relevant solution.
>
> Any inputs are appreciated.
>
> Thanks,
> Anlkur
>
> --
> 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

-- 
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