Skip to content

Most visited

Recently visited

navigation

TimeKeyListener

public class TimeKeyListener
extends NumberKeyListener

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


For entering times 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

From class android.text.method.MetaKeyKeyListener

Fields

public static final char[] CHARACTERS

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

Public constructors

TimeKeyListener()

This constructor was deprecated in API level 26. Use TimeKeyListener(Locale) instead.

TimeKeyListener(Locale locale)

Public methods

int getInputType()
static TimeKeyListener getInstance()

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

static TimeKeyListener getInstance(Locale locale)

Returns an instance of TimeKeyListener appropriate for the given locale.

Protected methods

char[] getAcceptedChars()

You can say which characters you can accept.

Inherited methods

From class android.text.method.NumberKeyListener
From class android.text.method.BaseKeyListener
From class android.text.method.MetaKeyKeyListener
From class java.lang.Object
From interface android.text.InputFilter
From interface android.text.method.KeyListener

Fields

CHARACTERS

added in API level 1
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.

Public constructors

TimeKeyListener

added in API level 1
TimeKeyListener ()

This constructor was deprecated in API level 26.
Use TimeKeyListener(Locale) instead.

TimeKeyListener

added in API level 26
TimeKeyListener (Locale locale)

Parameters
locale Locale

This value may be null.

Public methods

getInputType

added in API level 3
int getInputType ()

Returns
int

getInstance

added in API level 1
TimeKeyListener getInstance ()

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

Returns
TimeKeyListener

This value will never be null.

getInstance

added in API level 26
TimeKeyListener getInstance (Locale locale)

Returns an instance of TimeKeyListener appropriate for the given locale.

Parameters
locale Locale

This value may be null.

Returns
TimeKeyListener

This value will never be null.

Protected methods

getAcceptedChars

added in API level 1
char[] getAcceptedChars ()

You can say which characters you can accept.

Returns
char[]

This value will never be null.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)