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. Route between two GeoPoints/ lat-lon pairs


i am using the android 1.6 sdk. i search for a function / api, where i
can find a route between 2 points.
The DrivingDirections library doesn't exist!? So if there is a
function or an api for that, please let me know.
I take a look in the google-addon for android, but i don't find
something for my problem.

Currently, I get location updates as often as possible
Is the only way to connect all this points to a route the "reverse
Geocodring" (to get the street names) and draw a line from point A to
Point B on the map (i mean to use an Overlay and draw a straight line
between the points)? On straight routes that would be no problem, but
in curves/turns?

What I want is, that i only get the GPS-points. Then some functions
should reconstruct the route with all curves/turns.


2. Multiple SDK version HOWTO?

I need to be able to target 1.1 and 1.5/6 versions of the SDK for
projects. What the best practice for running multiple versions of the
SDK? Can I have them all in the same Eclipse install? Or should I use
separate installs of Eclipse?



3. OOM error caught bei DefaultException handler ... but there is plenty of memory

4. Obvious color banding

5. Multiple tables in one ContentProvider

6. Query regarding full screen mode

7. Parsing a https xml feed using SAX