DigitsKeyListener
open class DigitsKeyListener : NumberKeyListener
| kotlin.Any | ||||
| ↳ | android.text.method.MetaKeyKeyListener | |||
| ↳ | android.text.method.BaseKeyListener | |||
| ↳ | android.text.method.NumberKeyListener | |||
| ↳ | android.text.method.DigitsKeyListener | |||
For digits-only text entry
As for all implementations ofKeyListener, this class is only concerned with hardware keyboards. Software input methods have no obligation to trigger the methods in this class.
    Summary
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
| Allocates a DigitsKeyListener that accepts the ASCII digits 0 through 9. | |
| DigitsKeyListener(sign: Boolean, decimal: Boolean)Allocates a DigitsKeyListener that accepts the ASCII digits 0 through 9, plus the ASCII plus or minus sign (only at the beginning) and/or the ASCII period ('.') as the decimal point (only one per field) if specified. | |
| DigitsKeyListener(locale: Locale?) | |
| DigitsKeyListener(locale: Locale?, sign: Boolean, decimal: Boolean) | |
| Public methods | |
|---|---|
| open CharSequence! | |
| open Int | Returns the input type for the listener. | 
| open static DigitsKeyListener | Returns a DigitsKeyListener that accepts the ASCII digits 0 through 9. | 
| open static DigitsKeyListener | getInstance(sign: Boolean, decimal: Boolean)Returns a DigitsKeyListener that accepts the ASCII digits 0 through 9, plus the ASCII plus or minus sign (only at the beginning) and/or the ASCII period ('.') as the decimal point (only one per field) if specified. | 
| open static DigitsKeyListener | getInstance(accepted: String)Returns a DigitsKeyListener that accepts only the characters that appear in the specified String. | 
| open static DigitsKeyListener | getInstance(locale: Locale?)Returns a DigitsKeyListener that accepts the locale-appropriate digits. | 
| open static DigitsKeyListener | getInstance(locale: Locale?, sign: Boolean, decimal: Boolean)Returns a DigitsKeyListener that accepts the locale-appropriate digits, plus the locale-appropriate plus or minus sign (only at the beginning) and/or the locale-appropriate decimal separator (only one per field) if specified. | 
| Protected methods | |
|---|---|
| open CharArray | |
| Inherited functions | |
|---|---|
Public constructors
DigitsKeyListener
DigitsKeyListener()
Deprecated: Use DigitsKeyListener(java.util.Locale) instead.
Allocates a DigitsKeyListener that accepts the ASCII digits 0 through 9.
DigitsKeyListener
DigitsKeyListener(
sign: Boolean,
decimal: Boolean)
Deprecated: Use DigitsKeyListener(java.util.Locale,boolean,boolean) instead.
Allocates a DigitsKeyListener that accepts the ASCII digits 0 through 9, plus the ASCII plus or minus sign (only at the beginning) and/or the ASCII period ('.') as the decimal point (only one per field) if specified.
DigitsKeyListener
DigitsKeyListener(locale: Locale?)
| Parameters | |
|---|---|
| locale | Locale?: This value may be null. | 
DigitsKeyListener
DigitsKeyListener(
locale: Locale?,
sign: Boolean,
decimal: Boolean)
| Parameters | |
|---|---|
| locale | Locale?: This value may be null. | 
Public methods
filter
open fun filter(
source: CharSequence!,
start: Int,
end: Int,
dest: Spanned!,
dstart: Int,
dend: Int
): CharSequence!
getInputType
open fun getInputType(): Int
Returns the input type for the listener.
getInstance
open static fungetInstance(): DigitsKeyListener
Deprecated: Use getInstance(java.util.Locale) instead.
Returns a DigitsKeyListener that accepts the ASCII digits 0 through 9.
| Return | |
|---|---|
| DigitsKeyListener | This value cannot be null. | 
getInstance
open static fungetInstance(
sign: Boolean,
decimal: Boolean
): DigitsKeyListener
Deprecated: Use getInstance(java.util.Locale,boolean,boolean) instead.
Returns a DigitsKeyListener that accepts the ASCII digits 0 through 9, plus the ASCII plus or minus sign (only at the beginning) and/or the ASCII period ('.') as the decimal point (only one per field) if specified.
| Return | |
|---|---|
| DigitsKeyListener | This value cannot be null. | 
getInstance
open static fun getInstance(accepted: String): DigitsKeyListener
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.
| Parameters | |
|---|---|
| accepted | String: This value cannot be null. | 
| Return | |
|---|---|
| DigitsKeyListener | This value cannot be null. | 
getInstance
open static fun getInstance(locale: Locale?): DigitsKeyListener
Returns a DigitsKeyListener that accepts the locale-appropriate digits.
| Parameters | |
|---|---|
| locale | Locale?: This value may be null. | 
| Return | |
|---|---|
| DigitsKeyListener | This value cannot be null. | 
getInstance
open static fun getInstance(
locale: Locale?,
sign: Boolean,
decimal: Boolean
): DigitsKeyListener
Returns a DigitsKeyListener that accepts the locale-appropriate digits, plus the locale-appropriate plus or minus sign (only at the beginning) and/or the locale-appropriate decimal separator (only one per field) if specified.
| Parameters | |
|---|---|
| locale | Locale?: This value may be null. | 
| Return | |
|---|---|
| DigitsKeyListener | This value cannot be null. | 
Protected methods
getAcceptedChars
protected open fun getAcceptedChars(): CharArray
| Return | |
|---|---|
| CharArray | This value cannot be null. | 
