Android APIs
Added in API level 3
public static interface

KeyboardView.OnKeyboardActionListener

android.inputmethodservice.KeyboardView.OnKeyboardActionListener

Class Overview

Listener for virtual keyboard events.

Summary

Public Methods
abstract void onKey(int primaryCode, int[] keyCodes)
Send a key press to the listener.
abstract void onPress(int primaryCode)
Called when the user presses a key.
abstract void onRelease(int primaryCode)
Called when the user releases a key.
abstract void onText(CharSequence text)
Sends a sequence of characters to the listener.
abstract void swipeDown()
Called when the user quickly moves the finger from up to down.
abstract void swipeLeft()
Called when the user quickly moves the finger from right to left.
abstract void swipeRight()
Called when the user quickly moves the finger from left to right.
abstract void swipeUp()
Called when the user quickly moves the finger from down to up.

Public Methods

public abstract void onKey (int primaryCode, int[] keyCodes)

Added in API level 3

Send a key press to the listener.

Parameters
primaryCode this is the key that was pressed
keyCodes the codes for all the possible alternative keys with the primary code being the first. If the primary key code is a single character such as an alphabet or number or symbol, the alternatives will include other characters that may be on the same key or adjacent keys. These codes are useful to correct for accidental presses of a key adjacent to the intended key.

public abstract void onPress (int primaryCode)

Added in API level 3

Called when the user presses a key. This is sent before the onKey(int, int[]) is called. For keys that repeat, this is only called once.

Parameters
primaryCode the unicode of the key being pressed. If the touch is not on a valid key, the value will be zero.

public abstract void onRelease (int primaryCode)

Added in API level 3

Called when the user releases a key. This is sent after the onKey(int, int[]) is called. For keys that repeat, this is only called once.

Parameters
primaryCode the code of the key that was released

public abstract void onText (CharSequence text)

Added in API level 3

Sends a sequence of characters to the listener.

Parameters
text the sequence of characters to be displayed.

public abstract void swipeDown ()

Added in API level 3

Called when the user quickly moves the finger from up to down.

public abstract void swipeLeft ()

Added in API level 3

Called when the user quickly moves the finger from right to left.

public abstract void swipeRight ()

Added in API level 3

Called when the user quickly moves the finger from left to right.

public abstract void swipeUp ()

Added in API level 3

Called when the user quickly moves the finger from down to up.