English | Site Directory

Android - An Open Handset Alliance Project

android.text.method
public class

android.text.method.KeyCharacterMap

java.lang.Object
android.text.method.KeyCharacterMap

Summary

Constants

      Value  
int  ALPHA  A keyboard with all the letters, and maybe some numbers.  0x00000003 
int  BUILT_IN_KEYBOARD  The id of the device's primary built in keyboard is always 0.  0x00000000 
int  NUMERIC  A numeric (12-key) keyboard.  0x00000001 
int  PREDICTIVE  A keyboard with all the letters, but with more than one letter per key.  0x00000002 

Public Methods

        int  get(int keyCode, int meta)
        int  getDeadChar(char accent, int c)
Get the character that is produced by putting accent on the character c.
        char  getDisplayLabel(int keyCode)
Get the primary character for this key.
        KeyEvent[]  getEvents(char[] chars)
Get an array of KeyEvent objects that if put into the input stream could plausibly generate the provided sequence of characters.
        boolean  getKeyData(int keyCode, char[] results)
Get the characters conversion data for a given keyCode.
        int  getKeyboardType()
Returns NUMERIC, PREDICTIVE or ALPHA.
        char  getMatch(int keyCode, char[] chars, int modifiers)
If one of the chars in the array can be generated by keyCode, return the char; otherwise return '\0'.
        char  getMatch(int keyCode, char[] chars)
The same as getMatch(keyCode, chars, 0).
        char  getNumber(int keyCode)
Gets the number or symbol associated with the key.
        boolean  isPrintingKey(int keyCode)
Does this character key produce a glyph?
      static  KeyCharacterMap  load(int keyboard)

Protected Methods

        void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object

Details

Constants

public static final int ALPHA

A keyboard with all the letters, and maybe some numbers.
Constant Value: 3 (0x00000003)

public static final int BUILT_IN_KEYBOARD

The id of the device's primary built in keyboard is always 0.
Constant Value: 0 (0x00000000)

public static final int NUMERIC

A numeric (12-key) keyboard.
Constant Value: 1 (0x00000001)

public static final int PREDICTIVE

A keyboard with all the letters, but with more than one letter per key.
Constant Value: 2 (0x00000002)

Public Methods

public int get(int keyCode, int meta)

public int getDeadChar(char accent, int c)

Get the character that is produced by putting accent on the character c.

public char getDisplayLabel(int keyCode)

Get the primary character for this key. In other words, the label that is physically printed on it.

public KeyEvent[] getEvents(char[] chars)

Get an array of KeyEvent objects that if put into the input stream could plausibly generate the provided sequence of characters. It is not guaranteed that the sequence is the only way to generate these events or that it is optimal.

Returns

  • an array of KeyEvent objects, or null if the given char array can not be generated using the current key character map.

public boolean getKeyData(int keyCode, char[] results)

Get the characters conversion data for a given keyCode.

Parameters

keyCode the keyCode to look for
results a char[] that will be filled with the results. The array must have at least 6 elements. They will be filled in as follows:
IndexValue
0no modifiers
1caps
2alt
3caps + alt
4"number" value (see getNumber(int))
5display label (see getDisplayLabel(int)

Returns

  • whether the key was mapped or not. If the key was not mapped, results is not modified.

public int getKeyboardType()

Returns NUMERIC, PREDICTIVE or ALPHA.

public char getMatch(int keyCode, char[] chars, int modifiers)

If one of the chars in the array can be generated by keyCode, return the char; otherwise return '\0'.

Parameters

keyCode the key code to look at
chars the characters to try to find
modifiers the modifier bits to prefer. If any of these bits are set, if there are multiple choices, that could work, the one for this modifier will be set.

public char getMatch(int keyCode, char[] chars)

public char getNumber(int keyCode)

Gets the number or symbol associated with the key. The character value is returned, not the numeric value. If the key is not a number, but is a symbol, the symbol is retuned.

public boolean isPrintingKey(int keyCode)

Does this character key produce a glyph?

public static KeyCharacterMap load(int keyboard)

Protected Methods

protected void finalize()

Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Throws

Throwable
Build m5-rc15g - 14 May 2008 12:50