[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/android/text/method/DateKeyListener [Back]  [Original]

DateKeyListener  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.

DateKeyListener


public class DateKeyListener
extends NumberKeyListener

java.lang.Object
   ↳ android.text.method.MetaKeyKeyListener
     ↳ android.text.method.BaseKeyListener
       ↳ android.text.method.NumberKeyListener
         ↳ android.text.method.DateKeyListener


For entering dates in a text field.

As for all implementations of KeyListener, this class is only concerned with hardware keyboards. Software input methods have no obligation to trigger the methods in this class.

Summary

Inherited constants

Fields

public static final char[] CHARACTERS

This field was deprecated in API level 26. Use getAcceptedChars() instead.

Public constructors

DateKeyListener()

This constructor is deprecated. Use DateKeyListener(Locale) instead.

DateKeyListener(Locale locale)

Public methods

int getInputType()

static DateKeyListener getInstance()

This method was deprecated in API level 26. Use getInstance(Locale) instead.

static DateKeyListener getInstance(Locale locale)

Returns an instance of DateKeyListener appropriate for the given locale.

Protected methods

char[] getAcceptedChars()

You can say which characters you can accept.

Inherited methods

Fields

CHARACTERS

Added in API level 1
Deprecated in API level 26
public static final char[] CHARACTERS

This field was deprecated in API level 26.
Use getAcceptedChars() instead.

This field used to list the characters that were used. But is now a fixed data field that is the list of code units used for the deprecated case where the class is instantiated with null or no input parameter.

See also:

Public constructors

DateKeyListener

Added in API level 1
public DateKeyListener ()

This constructor is deprecated.
Use DateKeyListener(Locale) instead.

DateKeyListener

Added in API level 26
public DateKeyListener (Locale locale)

Parameters
locale Locale: This value may be null.

Public methods

getInputType

Added in API level 3
public int getInputType ()

Returns
int

getInstance

Added in API level 1
Deprecated in API level 26
public static DateKeyListener getInstance ()

This method was deprecated in API level 26.
Use getInstance(Locale) instead.

Returns
DateKeyListener This value cannot be null.

getInstance

Added in API level 26
public static DateKeyListener getInstance (Locale locale)

Returns an instance of DateKeyListener appropriate for the given locale.

Parameters
locale Locale: This value may be null.

Returns
DateKeyListener This value cannot be null.

Protected methods

getAcceptedChars

Added in API level 1
protected char[] getAcceptedChars ()

You can say which characters you can accept.

Returns
char[] This value cannot be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-08-03 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-03 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page