Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public abstract class

AbstractInputMethodService

extends Service
implements KeyEvent.Callback
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.inputmethodservice.AbstractInputMethodService
Known Direct Subclasses

Class Overview

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
class AbstractInputMethodService.AbstractInputMethodImpl Base class for derived classes to implement their InputMethod interface. 
class AbstractInputMethodService.AbstractInputMethodSessionImpl Base class for derived classes to implement their InputMethodSession interface. 
[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
AbstractInputMethodService ()
Public Methods
KeyEvent.DispatcherState getKeyDispatcherState ()
Return the global KeyEvent.DispatcherState for used for processing events from the target application.
final IBinder onBind ( Intent intent)
Return the communication channel to the service.
abstract AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface ()
Called by the framework during initialization, when the InputMethod interface for this service needs to be created.
abstract AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface ()
Called by the framework when a new InputMethodSession interface is needed for a new client of the input method.
boolean onGenericMotionEvent ( MotionEvent event)
Implement this to handle generic motion events on your input method.
boolean onTrackballEvent ( MotionEvent event)
Implement this to handle trackball events on your input method.
Protected Methods
void dump ( FileDescriptor fd, PrintWriter fout, String[] args)
Implement this to handle Binder.dump() calls on your input method.
[Expand]
Inherited Methods
From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.KeyEvent.Callback

Public Constructors

public AbstractInputMethodService ()

Added in API level 3

Public Methods

public KeyEvent.DispatcherState getKeyDispatcherState ()

Added in API level 5

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(int, KeyEvent) .

public final IBinder onBind ( Intent intent)

Added in API level 3

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl .

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process . More information about the main thread can be found in Processes and Threads .

Parameters
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.
Returns
  • Return an IBinder through which clients can call on to the service.

public abstract AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface ()

Added in API level 3

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

public abstract AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface ()

Added in API level 3

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

public boolean onGenericMotionEvent ( MotionEvent event)

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

Parameters
event The motion event being received.
Returns
  • True if the event was handled in this function, false otherwise.

public boolean onTrackballEvent ( MotionEvent event)

Added in API level 3

Implement this to handle trackball events on your input method.

Parameters
event The motion event being received.
Returns
  • True if the event was handled in this function, false otherwise.

Protected Methods

protected void dump ( FileDescriptor fd, PrintWriter fout, String[] args)

Added in API level 3

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

Parameters
fd The raw file descriptor that the dump is being sent to.
fout The PrintWriter to which you should dump your state. This will be closed for you after you return.
args additional arguments to the dump request.