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. Launcher activity


can anyone tell me where the applications like browser,contacts,
settings get populated when the Launcher activity is being launched?

Is that SlidingDrawer does this population?

Does the AllAppsGridView has any part in  this?


2. i want to control speed "ellipsize=marquee"

There you go

>> > 

3. Problem in switching views

4. Soft keyboard on activity startup

5. How to remove the afterimage of AutoCompleteTextView?

6. how to use bootanimaiton.zi

7. install android di open moko