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< http://developer.android.com/reference/android/view/inputmethod/InputConnection.html #setSelection(int,
 
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. Require J2ME (Android) developers with hands on experience in Blackberry & Android for Catalytic Software Limited (CMML5)

Currently, we are looking for J2me Developers with 2 to 4 years of
experience.

Skill set:- J2me, BlackBerry, Android, MIDP, API

Job Location:- Hyderabad

You can read more about Catalytic, the people, and philosophy by
visiting our corporate website at www.catalytic.com

I request you to kindly send your updated resume with current,
expected salary details and earliest available date to assume work to
initiate the discussions to vanitha.govi...@catalytic.com

--~--~---------~--~----~------------~-------~--~----~

2. Can the packages which begin with "com.google" be used for free?

Can the packages which begin with "com.google"  be used for free? Such
as com.google.android.providers.AbstractGDataSyncAdapter.

--~--~---------~--~----~------------~-------~--~----~

3. DHCP request failed wifi with WEP2 enterprise

4. Accessibilityservice

5. Playing Audio file to the caller

6. How to cache mapview tiles?

7. Where is the aapt.exe in SDK 1.5 and 1.6