Most visited

Recently visited

Added in API level 3

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
Known Direct Subclasses


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

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.

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.ComponentCallbacks2
From interface android.view.KeyEvent.Callback
From interface android.content.ComponentCallbacks

Public constructors

AbstractInputMethodService

Added in API level 3
AbstractInputMethodService ()

Public methods

getKeyDispatcherState

Added in API level 5
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 onKeyDown(int, KeyEvent).

Returns
KeyEvent.DispatcherState

onBind

Added in API level 3
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

Added in API level 3
AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface ()

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

Returns
AbstractInputMethodService.AbstractInputMethodImpl

onCreateInputMethodSessionInterface

Added in API level 3
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

Added in API level 17
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

Added in API level 3
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

Added in API level 3
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.

Hooray!