Google is committed to advancing racial equity for Black communities. See how.
Added in API level 3

AbstractInputMethodService

abstract class AbstractInputMethodService : Service, KeyEvent.Callback
kotlin.Any
   ↳ android.content.Context
   ↳ android.content.ContextWrapper
   ↳ android.app.Service
   ↳ android.inputmethodservice.AbstractInputMethodService

AbstractInputMethodService provides a abstract base class for input methods. Normal input method implementations will not derive from this directly, instead building on top of InputMethodService or another more complete base class. Be sure to read InputMethod for more information on the basics of writing input methods.

This class combines a Service (representing the input method component to the system with the InputMethod interface that input methods must implement. This base class takes care of reporting your InputMethod from the service when clients bind to it, but provides no standard implementation of the InputMethod interface itself. Derived classes must implement that interface.

Summary

Nested classes
abstract

Base class for derived classes to implement their InputMethod interface.

abstract

Base class for derived classes to implement their InputMethodSession interface.

Inherited constants
Public constructors

Public methods
open KeyEvent.DispatcherState!

Return the global KeyEvent.DispatcherState for used for processing events from the target application.

IBinder?
onBind(intent: Intent!)

abstract AbstractInputMethodService.AbstractInputMethodImpl!

Called by the framework during initialization, when the InputMethod interface for this service needs to be created.

abstract AbstractInputMethodService.AbstractInputMethodSessionImpl!

Called by the framework when a new InputMethodSession interface is needed for a new client of the input method.

open Boolean

Implement this to handle generic motion events on your input method.

open Boolean

Implement this to handle trackball events on your input method.

Protected methods
open Unit
dump(fd: FileDescriptor!, fout: PrintWriter!, args: Array<String!>!)

Implement this to handle Binder.dump() calls on your input method.

Inherited functions

Public constructors

<init>

AbstractInputMethodService()

Public methods

getKeyDispatcherState

Added in API level 5
open fun getKeyDispatcherState(): KeyEvent.DispatcherState!

Return the global KeyEvent.DispatcherState for used for processing events from the target application. Normally you will not need to use this directly, but just use the standard high-level event callbacks like onKeyDown.

onBind

Added in API level 3
fun onBind(intent: Intent!): IBinder?
Parameters
intent Intent!: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Return
IBinder? Return an IBinder through which clients can call on to the service.

onCreateInputMethodInterface

Added in API level 3
abstract fun onCreateInputMethodInterface(): AbstractInputMethodService.AbstractInputMethodImpl!

Called by the framework during initialization, when the InputMethod interface for this service needs to be created.

onCreateInputMethodSessionInterface

Added in API level 3
abstract fun onCreateInputMethodSessionInterface(): AbstractInputMethodService.AbstractInputMethodSessionImpl!

Called by the framework when a new InputMethodSession interface is needed for a new client of the input method.

onGenericMotionEvent

Added in API level 17
open fun onGenericMotionEvent(event: MotionEvent!): Boolean

Implement this to handle generic motion events on your input method.

Parameters
event MotionEvent!: The motion event being received.
Return
Boolean True if the event was handled in this function, false otherwise.

onTrackballEvent

Added in API level 3
open fun onTrackballEvent(event: MotionEvent!): Boolean

Implement this to handle trackball events on your input method.

Parameters
event MotionEvent!: The motion event being received.
Return
Boolean True if the event was handled in this function, false otherwise.

Protected methods

dump

Added in API level 3
protected open fun dump(
    fd: FileDescriptor!,
    fout: PrintWriter!,
    args: Array<String!>!
): Unit

Implement this to handle Binder.dump() calls on your input method.

Parameters
fd FileDescriptor!: The raw file descriptor that the dump is being sent to.
writer The PrintWriter to which you should dump your state. This will be closed for you after you return.
args Array<String!>!: additional arguments to the dump request.