Methods Summary |
---|
public boolean | beginBatchEdit()Tell the editor that you are starting a batch of editor operations.
The editor will try to avoid sending you updates about its state
until {@link #endBatchEdit} is called.
|
public boolean | clearMetaKeyStates(int states)Clear the given meta key pressed states in the given input connection.
|
public boolean | commitCompletion(CompletionInfo text)Commit a completion the user has selected from the possible ones
previously reported to {@link InputMethodSession#displayCompletions
InputMethodSession.displayCompletions()}. This will result in the
same behavior as if the user had selected the completion from the
actual UI.
|
public boolean | commitText(java.lang.CharSequence text, int newCursorPosition)Commit text to the text box and set the new cursor position.
Any composing text set previously will be removed
automatically.
|
public boolean | deleteSurroundingText(int leftLength, int rightLength)Delete leftLength characters of text before the current cursor
position, and delete rightLength characters of text after the
current cursor position, excluding composing text.
|
public boolean | endBatchEdit()Tell the editor that you are done with a batch edit previously
initiated with {@link #endBatchEdit}.
|
public boolean | finishComposingText()Have the text editor finish whatever composing text is currently
active. This simply leaves the text as-is, removing any special
composing styling or other state that was around it. The cursor
position remains unchanged.
|
public int | getCursorCapsMode(int reqModes)Retrieve the current capitalization mode in effect at the current
cursor position in the text. See
{@link android.text.TextUtils#getCapsMode TextUtils.getCapsMode} for
more information.
This method may fail either if the input connection has become invalid
(such as its process crashing) or the client is taking too long to
respond with the text (it is given a couple seconds to return).
In either case, a 0 is returned.
|
public ExtractedText | getExtractedText(ExtractedTextRequest request, int flags)Retrieve the current text in the input connection's editor, and monitor
for any changes to it. This function returns with the current text,
and optionally the input connection can send updates to the
input method when its text changes.
This method may fail either if the input connection has become invalid
(such as its process crashing) or the client is taking too long to
respond with the text (it is given a couple seconds to return).
In either case, a null is returned.
|
public java.lang.CharSequence | getTextAfterCursor(int n, int flags)Get n characters of text after the current cursor position.
This method may fail either if the input connection has become invalid
(such as its process crashing) or the client is taking too long to
respond with the text (it is given a couple seconds to return).
In either case, a null is returned.
|
public java.lang.CharSequence | getTextBeforeCursor(int n, int flags)Get n characters of text before the current cursor position.
This method may fail either if the input connection has become invalid
(such as its process crashing) or the client is taking too long to
respond with the text (it is given a couple seconds to return).
In either case, a null is returned.
|
public boolean | performContextMenuAction(int id)Perform a context menu action on the field. The given id may be one of:
{@link android.R.id#selectAll},
{@link android.R.id#startSelectingText}, {@link android.R.id#stopSelectingText},
{@link android.R.id#cut}, {@link android.R.id#copy},
{@link android.R.id#paste}, {@link android.R.id#copyUrl},
or {@link android.R.id#switchInputMethod}
|
public boolean | performEditorAction(int editorAction)Have the editor perform an action it has said it can do.
|
public boolean | performPrivateCommand(java.lang.String action, android.os.Bundle data)API to send private commands from an input method to its connected
editor. This can be used to provide domain-specific features that are
only known between certain input methods and their clients. Note that
because the InputConnection protocol is asynchronous, you have no way
to get a result back or know if the client understood the command; you
can use the information in {@link EditorInfo} to determine if
a client supports a particular command.
|
public boolean | reportFullscreenMode(boolean enabled)Called by the IME to tell the client when it switches between fullscreen
and normal modes. This will normally be called for you by the standard
implementation of {@link android.inputmethodservice.InputMethodService}.
|
public boolean | sendKeyEvent(android.view.KeyEvent event)Send a key event to the process that is currently attached through
this input connection. The event will be dispatched like a normal
key event, to the currently focused; this generally is the view that
is providing this InputConnection, but due to the asynchronous nature
of this protocol that can not be guaranteed and the focus may have
changed by the time the event is received.
This method can be used to send key events to the application. For
example, an on-screen keyboard may use this method to simulate a hardware
keyboard. There are three types of standard keyboards, numeric (12-key),
predictive (20-key) and ALPHA (QWERTY). You can specify the keyboard type
by specify the device id of the key event.
You will usually want to set the flag
{@link KeyEvent#FLAG_SOFT_KEYBOARD KeyEvent.FLAG_SOFT_KEYBOARD} on all
key event objects you give to this API; the flag will not be set
for you.
|
public boolean | setComposingText(java.lang.CharSequence text, int newCursorPosition)Set composing text around the current cursor position with the given text,
and set the new cursor position. Any composing text set previously will
be removed automatically.
|
public boolean | setSelection(int start, int end)Set the selection of the text editor. To set the cursor position,
start and end should have the same value.
|