Can't get cursor position from InputConnection

by nattster » Fri, 20 May 2011 09:30:36 GMT

Sponsored Links
 I'm developing an Input Method. 
I'd like to change cursor position with 
*InputConnection.setSelection< #setSelection(int,

This method allows me to set absolute position of cursor.
But what I want is to move cursor relatively from current position.
(e.g. Move left 3 characters from current position)

I can't find method to get current cursor position.
Currently, I got this hack:

    InputConnection conn;
    CharSequence seq = conn.getTextBeforeCursor(1000, 0); 
    // will get as much characters as possible on the left of cursor

    int cursor_pos = seq.length();

Is there any better way to do this?
Should we introduce new method to InputConnection, i.e. getSelectionStart?


Other Threads

1. DeviceMonitor]Failed to start monitoring <Device-number>


I am facing this DeviceMonitor]Failed to start monitoring <device-
number> in my eclipse, thats why I not able to launch my application
in the device. To make it work I need to restart my system, it works
for 2-3 mins and after that it start showing this error.

Please help me in this issue.

Rahul Garg


2. Paging om @mas drie , help root x10mini

caranya gimana ? ko saya ga bisa make perintah adb di cmd ? , padahal saya
dah jalankan sdk setup.exe :( , ngikutin panduan b...@ryo beda karena beliau
make mac ,saya make windows jadi pening gagal mulu , ga bisa akses adb , apa
kudu update sdk ke donut 1.6 dulu ?

mohon bantuannya

Sent from my touch spica white

"Indonesian Android Community [id-android]" 

3. HELP.. X10 Mini Pro Colaps

4. encfs on android

5. Internal Storage

6. Google Maps - MapView - draw a nice flight route between 2 points

7. closed :Paging om @mas drie , help root x10mini