Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How the input method can request 'updateCursor' event?

we are implementing custom input method service and we are interested in receiving cursor update events. The documentation of InputMethodSession's updateCursor() says: "This method is called when cursor location of the target input field has changed within its window. This is not normally called, but will only be reported if requested by the input method."

How the input method can request this event?

Thanks in advance,

Andriy

like image 384
uaaquarius Avatar asked Nov 10 '10 09:11

uaaquarius


1 Answers

It looks like this is unimplemented. In the TextView implementation, calling updateCursor is conditional on InputMethodManager.isWatchingCursor, which is helpfully defined as follows:

/**
 * Returns true if the current input method wants to watch the location
 * of the input editor's cursor in its window.
 */
public boolean isWatchingCursor(View view) {
    return false;
}

Luckily, you can detect cursor movements using onUpdateSelection, although they will be given to you as a logical position within the text rather than a Rect.

like image 155
mhsmith Avatar answered Oct 11 '22 23:10

mhsmith