KMManager.updateSelectionRange()
Summary
The updateSelectionRange()
method updates the selection range of the current context.
Syntax
KMManager.updateSelectionRange(KeyboardType kbType, int selStart, int selEnd)
Parameters
kbType
- Keyboard type requesting the selection range update.
KEYBOARD_TYPE_INAPP
orKEYBOARD_TYPE_SYSTEM
. selStart
- The new selection start location.
selEnd
- The new selection end location.
Returns
Returns true
if the selection range was updated successfully, false
otherwise.
Description
Use this method to update the selection range of the current context. It must be called in response to InputMethodService's onUpdateSelection method and whenever InputMethodService's onStartInput method has been called. Normally you do not need to call this method for in-app keyboards.
Examples
Example: Using updateSelectionRange()
The following script illustrate the use of updateSelectionRange()
:
@Override
public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) {
super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart, candidatesEnd);
KMManager.updateSelectionRange(KMManager.KeyboardType.KEYBOARD_TYPE_SYSTEM, newSelStart, newSelEnd);
}