Android
android.text.method
public class

android.text.method.DigitsKeyListener

java.lang.Object
android.text.method.MetaKeyKeyListener
android.text.method.BaseKeyListener KeyListener
android.text.method.NumberKeyListener InputFilter
android.text.method.DigitsKeyListener

For digits-only text entry

Summary

Constants inherited from class android.text.method.MetaKeyKeyListener

Public Constructors

            DigitsKeyListener()
Allocates a DigitsKeyListener that accepts the digits 0 through 9.
            DigitsKeyListener(boolean sign, boolean decimal)
Allocates a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified.

Public Methods

          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.
      static    DigitsKeyListener  getInstance(boolean sign, boolean decimal)
Returns a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified.
      static    DigitsKeyListener  getInstance()
Returns a DigitsKeyListener that accepts the digits 0 through 9.
      static    DigitsKeyListener  getInstance(String accepted)
Returns a DigitsKeyListener that accepts only the characters that appear in the specified String.

Protected Methods

          char[]  getAcceptedChars()
You can say which characters you can accept.
Methods inherited from class android.text.method.NumberKeyListener
Methods inherited from class android.text.method.BaseKeyListener
Methods inherited from class android.text.method.MetaKeyKeyListener
Methods inherited from class java.lang.Object
Methods inherited from interface android.text.InputFilter
Methods inherited from interface android.text.method.KeyListener

Details

Public Constructors

public DigitsKeyListener()

Allocates a DigitsKeyListener that accepts the digits 0 through 9.

public DigitsKeyListener(boolean sign, boolean decimal)

Allocates a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified.

Public Methods

public 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. 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.

public static DigitsKeyListener getInstance(boolean sign, boolean decimal)

Returns a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified.

public static DigitsKeyListener getInstance()

Returns a DigitsKeyListener that accepts the digits 0 through 9.

public static DigitsKeyListener getInstance(String accepted)

Returns a DigitsKeyListener that accepts only the characters that appear in the specified String. Note that not all characters may be available on every keyboard.

Protected Methods

protected char[] getAcceptedChars()

You can say which characters you can accept.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56