android.text.method
Class NumberKeyListener
java.lang.Object
android.text.method.MetaKeyKeyListener
android.text.method.BaseKeyListener
android.text.method.NumberKeyListener
- All Implemented Interfaces:
- InputFilter, KeyListener
- Direct Known Subclasses:
- DateKeyListener, DateTimeKeyListener, DialerKeyListener, DigitsKeyListener, TimeKeyListener
public abstract class NumberKeyListener
- extends BaseKeyListener
- implements InputFilter
For numeric text entry
|
Method Summary |
CharSequence |
filter(CharSequence source,
int start,
int end,
Spanned dest,
int dstart,
int dend)
This method is called when the buffer is going to replace the
range dstart … dend of dest
with the new text from the range start … end
of source. |
protected abstract char[] |
getAcceptedChars()
You can say which characters you can accept. |
protected int |
lookup(KeyEvent event,
Spannable content)
|
protected static boolean |
ok(char[] accept,
char c)
|
boolean |
onKeyDown(View view,
Editable content,
int keyCode,
KeyEvent event)
Handles presses of the meta keys. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NumberKeyListener
public NumberKeyListener()
getAcceptedChars
protected abstract char[] getAcceptedChars()
- You can say which characters you can accept.
lookup
protected int lookup(KeyEvent event,
Spannable content)
filter
public CharSequence filter(CharSequence source,
int start,
int end,
Spanned dest,
int dstart,
int dend)
- Description copied from interface:
InputFilter
- This method is called when the buffer is going to replace the
range
dstart … dend of dest
with the new text from the range start … end
of source. Return the CharSequence that you would
like to have placed there instead, including an empty string
if appropriate, or null to accept the original
replacement. Be careful to not to reject 0-length replacements,
as this is what happens when you delete text. Also beware that
you should not attempt to make any changes to dest
from this method; you may only examine it for context.
- Specified by:
filter in interface InputFilter
ok
protected static boolean ok(char[] accept,
char c)
onKeyDown
public boolean onKeyDown(View view,
Editable content,
int keyCode,
KeyEvent event)
- Description copied from class:
MetaKeyKeyListener
- Handles presses of the meta keys.
- Specified by:
onKeyDown in interface KeyListener- Overrides:
onKeyDown in class BaseKeyListener
Please submit a feedback, bug or feature