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. how to use MediaRecorder to record highest quality video?


Is there a way to get the best quality of video recording possible
using MediaRecorder? the camcorder app does a lot better in terms of

Any help?




2. Camera on Eclairs


I am facing one issue w.r.t camera display on our platform. We are using
Eclaris 2.0 version of Android release.

I am trying to get the Camera up on a QVGA display. When the VF (ViewFinder)
comes up, I see that the image is present in the centre of the display in a
small region (176x144). But on the Donut release, I was able to get the VF
in full screen. (320x240). I think the configuration settings for the full
screen VF might have got changed in Eclaris.

Can anyone please let me know how to modify the VF area to get it in full
screen? I tried changing the parameters in and
AndroidManifest.xml file present under packages/apps/Camera directory, but
of no use.

Thanking you,
Vinay K.


3. How to build the andriod with buildroot?

4. f-sale : N1 BNIB

5. VBO and DrawTex support

6. Button properties not set properly

7. Ask harga Dream dan beberapa pertanyaan