Example usage for android.view.inputmethod InputConnection GET_EXTRACTED_TEXT_MONITOR

List of usage examples for android.view.inputmethod InputConnection GET_EXTRACTED_TEXT_MONITOR

Introduction

In this page you can find the example usage for android.view.inputmethod InputConnection GET_EXTRACTED_TEXT_MONITOR.

Prototype

int GET_EXTRACTED_TEXT_MONITOR

To view the source code for android.view.inputmethod InputConnection GET_EXTRACTED_TEXT_MONITOR.

Click Source Link

Document

Flag for use with #getExtractedText to indicate you would like to receive updates when the extracted text changes.

Usage

From source file:com.googlecode.eyesfree.brailleback.BrailleIME.java

@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
    super.onStartInput(attribute, restarting);
    LogUtils.log(this, Log.VERBOSE,
            "onStartInput: inputType: %x, imeOption: %x, " + ", label: %s, hint: %s, package: %s, ",
            attribute.inputType, attribute.imeOptions, attribute.label, attribute.hintText,
            attribute.packageName);//from  w  w  w . j  a va 2s  . c  o  m
    InputConnection ic = getCurrentInputConnection();
    if (ic != null) {
        ExtractedTextRequest req = new ExtractedTextRequest();
        req.token = ++mExtractedTextToken;
        req.hintMaxChars = MAX_REQUEST_CHARS;
        mExtractedText = getCurrentInputConnection().getExtractedText(req,
                InputConnection.GET_EXTRACTED_TEXT_MONITOR);
    } else {
        mExtractedText = null;
    }
    updateCurrentText();
    updateDisplay();

    Host host = getHost();
    if (host != null) {
        host.onStartInput(attribute, restarting);
    }
}