# Print output for @column tags ?> AbstractInputMethodService - Android SDK | Android Developers

Most visited

Recently visited

AbstractInputMethodService

public abstract class AbstractInputMethodService
extends Service implements KeyEvent.Callback

java.lang.Object
   ↳ 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

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. 

Inherited constants

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.

Inherited methods

Public constructors

AbstractInputMethodService

public AbstractInputMethodService ()

Public methods

getKeyDispatcherState

public KeyEvent.DispatcherState getKeyDispatcherState ()

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

Returns
KeyEvent.DispatcherState

onBind

public final IBinder onBind (Intent intent)

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

onCreateInputMethodInterface

public abstract AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface ()

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

Returns
AbstractInputMethodService.AbstractInputMethodImpl

onCreateInputMethodSessionInterface

public abstract AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface ()

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

Returns
AbstractInputMethodService.AbstractInputMethodSessionImpl

onGenericMotionEvent

public boolean onGenericMotionEvent (MotionEvent event)

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

Parameters
event MotionEvent: The motion event being received.

Returns
boolean True if the event was handled in this function, false otherwise.

See also:

onTrackballEvent

public boolean onTrackballEvent (MotionEvent event)

Implement this to handle trackball events on your input method.

Parameters
event MotionEvent: The motion event being received.

Returns
boolean True if the event was handled in this function, false otherwise.

See also:

Protected methods

dump

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

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.

fout PrintWriter: The PrintWriter to which you should dump your state. This will be closed for you after you return.

args String: additional arguments to the dump request.