Stay organized with collections Save and categorize content based on your preferences.

public abstract class AbstractInputMethodService.AbstractInputMethodSessionImpl
extends Object implements InputMethodSession

java.lang.Object
   ↳ android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl


Base class for derived classes to implement their InputMethodSession interface. This takes care of basic maintenance of the session, but most behavior must be implemented in a derived class.

Summary

Public constructors

AbstractInputMethodSessionImpl()

Public methods

void dispatchGenericMotionEvent(int seq, MotionEvent event, InputMethodSession.EventCallback callback)

Take care of dispatching incoming generic motion events to the appropriate callbacks on the service, and tell the client when this is done.

void dispatchKeyEvent(int seq, KeyEvent event, InputMethodSession.EventCallback callback)

Take care of dispatching incoming key events to the appropriate callbacks on the service, and tell the client when this is done.

void dispatchTrackballEvent(int seq, MotionEvent event, InputMethodSession.EventCallback callback)

Take care of dispatching incoming trackball events to the appropriate callbacks on the service, and tell the client when this is done.

boolean isEnabled()

Check whether this session has been enabled by the system.

boolean isRevoked()

Check whether this session has been revoked by the system.

void revokeSelf()

Revoke the session from the client.

void setEnabled(boolean enabled)

Change the enabled state of the session.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

From interface android.view.inputmethod.InputMethodSession

abstract void appPrivateCommand(String action, Bundle data)

Process a private command sent from the application to the input method.

abstract void dispatchGenericMotionEvent(int seq, MotionEvent event, InputMethodSession.EventCallback callback)

This method is called when there is a generic motion event.

abstract void dispatchKeyEvent(int seq, KeyEvent event, InputMethodSession.EventCallback callback)

This method is called when a key is pressed.

abstract void dispatchTrackballEvent(int seq, MotionEvent event, InputMethodSession.EventCallback callback)

This method is called when there is a track ball event.

abstract void displayCompletions(CompletionInfo[] completions)

Called by a text editor that performs auto completion, to tell the input method about the completions it has available.

abstract void finishInput()

This method is called when the application would like to stop receiving text input.

abstract void toggleSoftInput(int showFlags, int hideFlags)

This method was deprecated in API level 31. Starting in Build.VERSION_CODES.S the system no longer invokes this method, instead it explicitly shows or hides the IME. An InputMethodService wishing to toggle its own visibility should instead invoke InputMethodService.requestShowSelf(int) or InputMethodService#requestHideSelf

abstract void updateCursor(Rect newCursor)

This method is called when cursor location of the target input field has changed within its window.

abstract void updateCursorAnchorInfo(CursorAnchorInfo cursorAnchorInfo)

This method is called when the cursor and/or the character position relevant to text input is changed on the screen.

abstract void updateExtractedText(int token, ExtractedText text)

Called by a text editor to report its new extracted text when its contents change.

abstract void updateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd)

This method is called when the selection or cursor in the current target input field has changed.

abstract void viewClicked(boolean focusChanged)

This method is called when the user tapped a text view.

Public constructors

AbstractInputMethodSessionImpl

public AbstractInputMethodSessionImpl ()

Public methods

dispatchGenericMotionEvent

public void dispatchGenericMotionEvent (int seq, 
                MotionEvent event, 
                InputMethodSession.EventCallback callback)

Take care of dispatching incoming generic motion events to the appropriate callbacks on the service, and tell the client when this is done.

Parameters
seq int
event MotionEvent: The motion event.
callback InputMethodSession.EventCallback
Returns
void Whether the input method wants to handle this event.

dispatchKeyEvent

public void dispatchKeyEvent (int seq, 
                KeyEvent event, 
                InputMethodSession.EventCallback callback)

Take care of dispatching incoming key events to the appropriate callbacks on the service, and tell the client when this is done.

Parameters
seq int
event KeyEvent: The key event.
callback InputMethodSession.EventCallback
Returns
void Whether the input method wants to handle this event.

dispatchTrackballEvent

public void dispatchTrackballEvent (int seq, 
                MotionEvent event, 
                InputMethodSession.EventCallback callback)

Take care of dispatching incoming trackball events to the appropriate callbacks on the service, and tell the client when this is done.

Parameters
seq int
event MotionEvent: The motion event.
callback InputMethodSession.EventCallback
Returns
void Whether the input method wants to handle this event.

isEnabled

public boolean isEnabled ()

Check whether this session has been enabled by the system. If not enabled, you should not execute any calls on to it.

Returns
boolean

isRevoked

public boolean isRevoked ()

Check whether this session has been revoked by the system. Revoked session is also always disabled, so there is generally no need to explicitly check for this.

Returns
boolean

revokeSelf

public void revokeSelf ()

Revoke the session from the client. This disabled the session, and prevents it from ever being enabled again.

setEnabled

public void setEnabled (boolean enabled)

Change the enabled state of the session. This only works if the session has not been revoked.

Parameters
enabled boolean

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-02-08 UTC.