# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods

# KeyListener

`public interface KeyListener`
``

android.text.method.KeyListener

Known indirect subclasses BaseKeyListener, DateKeyListener, DateTimeKeyListener, DialerKeyListener, DigitsKeyListener, MultiTapKeyListener, NumberKeyListener, QwertyKeyListener, TextKeyListener, TimeKeyListener
BaseKeyListener | Abstract base class for key listeners.
DateKeyListener | For entering dates in a text field.
DateTimeKeyListener | For entering dates and times in the same text field.
DialerKeyListener | For dialing-only text entry As for all implementations of `KeyListener`, this class is only concerned with hardware keyboards.
DigitsKeyListener | For digits-only text entry As for all implementations of `KeyListener`, this class is only concerned with hardware keyboards.
MultiTapKeyListener | This is the standard key listener for alphabetic input on 12-key keyboards.
NumberKeyListener | For numeric text entry As for all implementations of `KeyListener`, this class is only concerned with hardware keyboards.
QwertyKeyListener | This is the standard key listener for alphabetic input on qwerty keyboards.
TextKeyListener | This is the key listener for typing normal text.
TimeKeyListener | For entering times in a text field.

Interface for converting text key events into edit operations on an Editable class. Note that for most cases this interface has been superceded by general soft input methods as defined by `InputMethod`; it should only be used for cases where an application has its own on-screen keypad and also wants to process hard keyboard events to match it.

Key presses on soft input methods are not required to trigger the methods in this listener, and are in fact discouraged to do so. The default android keyboard will not trigger these for any key to any application targetting Jelly Bean or later, and will only deliver it for some key presses to applications targetting Ice Cream Sandwich or earlier.

## Summary

### Public methods
`abstract void` | `clearMetaKeyState(View view, Editable content, int states)` Remove the given shift states from the edited text.
`abstract int` | `getInputType()` Return the type of text that this key listener is manipulating, as per `InputType`.
`abstract boolean` | `onKeyDown(View view, Editable text, int keyCode, KeyEvent event)` If the key listener wants to handle this key, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.
`abstract boolean` | `onKeyOther(View view, Editable text, KeyEvent event)` If the key listener wants to other kinds of key events, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.
`abstract boolean` | `onKeyUp(View view, Editable text, int keyCode, KeyEvent event)` If the key listener wants to handle this key release, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.

## Public methods

### clearMetaKeyState

    public abstract void clearMetaKeyState (View view,
                    Editable content,
                    int states)

Remove the given shift states from the edited text.

Parameters
`view` | `View`
`content` | `Editable`
`states` | `int`

### getInputType

    public abstract int getInputType ()

Return the type of text that this key listener is manipulating, as per `InputType`. This is used to determine the mode of the soft keyboard that is shown for the editor.

If you return `InputType.TYPE_NULL` then no soft keyboard will provided. In other words, you must be providing your own key pad for on-screen input and the key listener will be used to handle input from a hard keyboard.

If you return any other value, a soft input method will be created when the user puts focus in the editor, which will provide a keypad and also consume hard key events. This means that the key listener will generally not be used, instead the soft input method will take care of managing key input as per the content type returned here.

Returns
`int` |

### onKeyDown

    public abstract boolean onKeyDown (View view,
                    Editable text,
                    int keyCode,
                    KeyEvent event)

If the key listener wants to handle this key, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.

Parameters
`view` | `View`
`text` | `Editable`
`keyCode` | `int`
`event` | `KeyEvent`

Returns
`boolean` |

### onKeyOther

    public abstract boolean onKeyOther (View view,
                    Editable text,
                    KeyEvent event)

If the key listener wants to other kinds of key events, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.

Parameters
`view` | `View`
`text` | `Editable`
`event` | `KeyEvent`

Returns
`boolean` |

### onKeyUp

    public abstract boolean onKeyUp (View view,
                    Editable text,
                    int keyCode,
                    KeyEvent event)

If the key listener wants to handle this key release, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.

Parameters
`view` | `View`
`text` | `Editable`
`keyCode` | `int`
`event` | `KeyEvent`

Returns
`boolean` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*