Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 14.0Version 13.0 (current release)Version 12.0Version 11.0Version 10.0Version 2.0

Index

On this page

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 or KEYBOARD_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);
    }

See also