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. [libgdx]texture animation flickers

Hi, guys.

  I am using libgdx...and experiencing the flickering problem..

  Situation: I try to render an animation which has 3 frames in one
sprite sheet.After i upload and run this on my HERO, the flickering
problem occurs.

                mElapsedTime +=;

                if (mElapsedTime > 0.3f) {
                        TextureRegion region = 

                        SpriteBatch batch = mBatch;
                        batch.draw(region.texture, 100f, 100f, region.x, 
region.width, region.height, Color.RED);

                        mElapsedTime = 0f;
                        mTextureRegionIndex = ++mTextureRegionIndex % 3;

I searched around and found

2. Is possible to debug OpenGL ES 2.0 application on Emulator?

Hi all,
I'm new in this group (and new as android developer). A question: is
it possible to debug OpenGL ES 2.0 applications on emulator or I need
a real target? Using emulator could be useful to test the same
application with different Android APIs.



3. Mobile Application Development in Openwave Computing !

4. SIpdroid and Trixbox over LAN?

5. Bug report, why it need more permissions?

6. set it up!

7. Android Life Cycle