How to set selection of editText by using SendKeyEvent function of InputConnection class

by DrBrain » Thu, 30 Apr 2009 02:06:02 GMT

Sponsored Links
 I need to set selection of an editText box via InputConnection. I used
the SendKeyEvent function with the KEYCODE_DPAD_LEFT and META_SHIFT_ON
state but I've had no luck. My code is as below:

// I've already received hardware key event of DPAD left key as event
parameter in this function.

// Change the meta state of event parameter to META_SHIFT_ON
event = new KeyEvent(event.getDownTime(), event.getEventTime(),
                        event.getAction(), event.getKeyCode(), 
                        event.getDeviceId(), event.getScanCode());
InputConnection ic = getCurrentInputConnection();

After excuting the code, there still no selection in the EditText.

Could somebody help me to resolve this ?

Thanks in advance.


Other Threads

1. How to go to Home screen..?

Hi friends,

               When the user clicks on a button, I want to navigate the
screen into Home Screen. How can we achieve this.



2. Paging Milestone Users

Halow all,

Paging Milestone user, please reply this message.


@ZuliadyAzwin <>

"Design is not just what it looks like and feels like. Design is how it
works" - Steve Jobs


3. Salam kenal from bogor

4. WTCurhat : Koneksi internet kembang kempis

5. Buttons supported in notification expanded view?

6. Help with Themes and Styles

7. repeating a set of animation sequentially