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. about XMPP (Openfire)

Hello everybody

How to create new account  from android client
Can anyone help me ?
Best Regard


2. Strange out of memory on bitmap but there is free heap space


I have a list view that display about 25 images with size 60x60 pixels.
I dowload this images from internet and I store in an arraylist as
Bitmap. I need to save it in a arraylist because a listview will recycle
views and so I need, wenn the user scroll, to display the image
in the new view WITHOUT downloading again from internet

But after some time I got

java.lang.OutOfMemoryError: bitmap size exceeds VM budget

It seams that I got this exception about after loading 20 images ...

Reading in forum I have read about memory heap.

I try to check the memory heap usage with:




When the exception occours both are about 4M.

But android has more than 4M?

When the application start the values are a little less to 4M so it seams is not
a big memory usage or memory leak.

To be sure I want to call :

but this method is and instance method and I can't find the object to invoke!!!

But this method say, that al min should an application have 16M!

Any help? I have seen many topics in google ... but all speak about
recycle. But if
I recycle a bitmat ... then should I download again from internet?

Should I store the image on flash memory or sd card instead an
arraylist in memory?

 _| _.  o _| _
(_| (_| \/ | (_| (/_


3. Are there any LDPI or HDPI devices running 1.5?

4. HDPI and LDPI Emulators Not Identifying Correctly?

5. start AlertDialog from AppWidgetProvider

6. Are there any LDPI or HDPI devices running 1.5?

7. ZoomButtonsController example