Google is committed to advancing racial equity for Black communities. See how.

HintConstants

class HintConstants
kotlin.Any
   ↳ androidx.autofill.HintConstants

Contains all the officially supported autofill hint constants.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_EMAIL_ADDRESS}) or .

Summary

Constants
static String

Hint indicating that this view can be autofilled with a birth day(of the month).

static String

Hint indicating that this view can be autofilled with a full birth date.

static String

Hint indicating that this view can be autofilled with a birth month.

static String

Hint indicating that this view can be autofilled with a birth year.

static String

Hint indicating that this view can be autofilled with a credit card expiration date.

static String

Hint indicating that this view can be autofilled with a credit card expiration day.

static String

Hint indicating that this view can be autofilled with a credit card expiration month.

static String

Hint indicating that this view can be autofilled with a credit card expiration year.

static String

Hint indicating that this view can be autofilled with a credit card number.

static String

Hint indicating that this view can be autofilled with a credit card security code.

static String

Hint indicating that this view can be autofilled with an email address.

static String

Hint indicating that this view can be autofilled with a gender.

static String

Hint indicating that this view can be autofilled with a user's real name.

static String

Hint indicating that this view can be interpreted as a newly created password for save/update.

static String

Hint indicating that this view can be interpreted as a newly created username for save/update.

static String

Hint indicating that this view can be autofilled with a password.

static String

Hint indicating that this view can be autofilled with a person's full name.

static String

Hint indicating that this view can be autofilled with a person's last/family name.

static String

Hint indicating that this view can be autofilled with a person's first/given name.

static String

Hint indicating that this view can be autofilled with a person's middle name.

static String

Hint indicating that this view can be autofilled with a person's middle initial.

static String

Hint indicating that this view can be autofilled with a person's name prefix.

static String

Hint indicating that this view can be autofilled with a person's name suffix.

static String

Hint indicating that this view can be autofilled with a phone number.

static String

Hint indicating that this view can be autofilled with a phone number's country code.

static String

Hint indicating that this view can be autofilled with a phone number without country code.

static String

Hint indicating that this view can be autofilled with the user's full phone number with country code.

static String

Hint indicating that this view can be autofilled with the current device's phone number usually for Sign Up / OTP flows.

static String

Hint indicating that this view can be autofilled with a postal address.

static String

Hint indicating that this view can be autofilled with a country name/code.

static String

Hint indicating that this view can be autofilled with auxiliary address details.

static String

Hint indicating that this view can be autofilled with an extended ZIP/POSTAL code.

static String

Hint indicating that this view can be autofilled with an address locality (city/town).

static String

Hint indicating that this view can be autofilled with a region/state.

static String

Hint indicating that this view can be autofilled with a street address.

static String

Hint indicating that this view can be autofilled with a postal code.

static String

Hint indicating that this view can be autofilled with a SMS One Time Password (OTP).

static String

Hint indicating that this view can be autofilled with a username.

Public methods
static String

Generates the corresponding hint that indicates that this view can be autofilled with the characterPosition'th character/digit of a SMS One Time Password (OTP).

Constants

AUTOFILL_HINT_BIRTH_DATE_DAY

static val AUTOFILL_HINT_BIRTH_DATE_DAY: String

Hint indicating that this view can be autofilled with a birth day(of the month).

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_BIRTH_DATE_DAY}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "birthDateDay"

AUTOFILL_HINT_BIRTH_DATE_FULL

static val AUTOFILL_HINT_BIRTH_DATE_FULL: String

Hint indicating that this view can be autofilled with a full birth date.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_BIRTH_DATE_FULL}).

The recommended approach is to use a date autofill value - see for more details.

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "birthDateFull"

AUTOFILL_HINT_BIRTH_DATE_MONTH

static val AUTOFILL_HINT_BIRTH_DATE_MONTH: String

Hint indicating that this view can be autofilled with a birth month.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_BIRTH_DATE_MONTH}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "birthDateMonth"

AUTOFILL_HINT_BIRTH_DATE_YEAR

static val AUTOFILL_HINT_BIRTH_DATE_YEAR: String

Hint indicating that this view can be autofilled with a birth year.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_BIRTH_DATE_YEAR}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "birthDateYear"

AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE

static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE: String

Hint indicating that this view can be autofilled with a credit card expiration date.

It should be used when the credit card expiration date is represented by just one view; if it is represented by more than one (for example, one view for the month and another view for the year), then each of these views should use the hint specific for the unit ( , , or ).

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}).

When annotating a view with this hint, it's recommended to use a date autofill value to avoid ambiguity when the autofill service provides a value for it. To understand why a value can be ambiguous, consider "April of 2020", which could be represented as either of the following options:

  • "04/2020"
  • "4/2020"
  • "2020/04"
  • "2020/4"
  • "April/2020"
  • "Apr/2020"

You define a date autofill value for the view by overriding the following methods:

  1. android.view.View#getAutofillType() to return .
  2. android.view.View#getAutofillValue() to return a .
  3. android.view.View#autofill(android.view.autofill.AutofillValue) to expect a data autofillvalue.

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardExpirationDate"

AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY

static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY: String

Hint indicating that this view can be autofilled with a credit card expiration day.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardExpirationDay"

AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH

static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH: String

Hint indicating that this view can be autofilled with a credit card expiration month.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}).

When annotating a view with this hint, it's recommended to use a text autofill value whose value is the numerical representation of the month, starting on 1 to avoid ambiguity when the autofill service provides a value for it. To understand why a value can be ambiguous, consider "January", which could be represented as either of

  • "1": recommended way.
  • "0": if following the java.util.Calendar#MONTH convention.
  • "January": full name, in English.
  • "jan": abbreviated name, in English.
  • "Janeiro": full name, in another language.

Another recommended approach is to use a date autofill value - see for more details.

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardExpirationMonth"

AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR

static val AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR: String

Hint indicating that this view can be autofilled with a credit card expiration year.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardExpirationYear"

AUTOFILL_HINT_CREDIT_CARD_NUMBER

static val AUTOFILL_HINT_CREDIT_CARD_NUMBER: String

Hint indicating that this view can be autofilled with a credit card number.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_NUMBER}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardNumber"

AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE

static val AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE: String

Hint indicating that this view can be autofilled with a credit card security code.

Can be used with either android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}).

See android.view.View#setAutofillHints(String...) for more info about autofill hints.

Value: "creditCardSecurityCode"

AUTOFILL_HINT_EMAIL_ADDRESS

static val AUTOFILL_HINT_EMAIL_ADDRESS: String

Hint indicating that this view can be autofilled with an email address.

Can be used with either