Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

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 android.view.View#setAutofillHints(String[]) or android:autofillHint (in which case the value should be {@value #AUTOFILL_HINT_EMAIL_ADDRESS}).

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

Value: "emailAddress"

AUTOFILL_HINT_GENDER

static val AUTOFILL_HINT_GENDER: String

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

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

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

Value: "gender"

AUTOFILL_HINT_NAME

static val AUTOFILL_HINT_NAME: String

Deprecated: replaced by {@value #AUTOFILL_HINT_PERSON_NAME} to be more specific

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

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

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

Value: "name"

AUTOFILL_HINT_NEW_PASSWORD

static val AUTOFILL_HINT_NEW_PASSWORD: String

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

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

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

Value: "newPassword"

AUTOFILL_HINT_NEW_USERNAME

static val AUTOFILL_HINT_NEW_USERNAME: String

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

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

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

Value: "newUsername"

AUTOFILL_HINT_PASSWORD

static val AUTOFILL_HINT_PASSWORD: String

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

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

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

Value: "password"

AUTOFILL_HINT_PERSON_NAME

static val AUTOFILL_HINT_PERSON_NAME: String

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

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

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

Value: "personName"

AUTOFILL_HINT_PERSON_NAME_FAMILY

static val AUTOFILL_HINT_PERSON_NAME_FAMILY: String

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

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

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

Value: "personFamilyName"

AUTOFILL_HINT_PERSON_NAME_GIVEN

static val AUTOFILL_HINT_PERSON_NAME_GIVEN: String

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

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

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

Value: "personGivenName"

AUTOFILL_HINT_PERSON_NAME_MIDDLE

static val AUTOFILL_HINT_PERSON_NAME_MIDDLE: String

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

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

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

Value: "personMiddleName"

AUTOFILL_HINT_PERSON_NAME_MIDDLE_INITIAL

static val AUTOFILL_HINT_PERSON_NAME_MIDDLE_INITIAL: String

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

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

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

Value: "personMiddleInitial"

AUTOFILL_HINT_PERSON_NAME_PREFIX

static val AUTOFILL_HINT_PERSON_NAME_PREFIX: String

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

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

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

Value: "personNamePrefix"

AUTOFILL_HINT_PERSON_NAME_SUFFIX

static val AUTOFILL_HINT_PERSON_NAME_SUFFIX: String

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

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

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

Value: "personNameSuffix"

AUTOFILL_HINT_PHONE

static val AUTOFILL_HINT_PHONE: String

Deprecated: replaced by {@value #AUTOFILL_HINT_PHONE_NUMBER} to be more specific

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

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

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

Value: "phone"

AUTOFILL_HINT_PHONE_COUNTRY_CODE

static val AUTOFILL_HINT_PHONE_COUNTRY_CODE: String

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

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

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

Value: "phoneCountryCode"

AUTOFILL_HINT_PHONE_NATIONAL

static val AUTOFILL_HINT_PHONE_NATIONAL: String

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

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

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

Value: "phoneNational"

AUTOFILL_HINT_PHONE_NUMBER

static val AUTOFILL_HINT_PHONE_NUMBER: String

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

Example: +1 123-456-7890

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

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

Value: "phoneNumber"

AUTOFILL_HINT_PHONE_NUMBER_DEVICE

static val AUTOFILL_HINT_PHONE_NUMBER_DEVICE: String

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

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

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

Value: "phoneNumberDevice"

AUTOFILL_HINT_POSTAL_ADDRESS

static val AUTOFILL_HINT_POSTAL_ADDRESS: String

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

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

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

Value: "postalAddress"

AUTOFILL_HINT_POSTAL_ADDRESS_COUNTRY

static val AUTOFILL_HINT_POSTAL_ADDRESS_COUNTRY: String

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

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

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

Value: "addressCountry"

AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_ADDRESS

static val AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_ADDRESS: String

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

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

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

Value: "extendedAddress"

AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_POSTAL_CODE

static val AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_POSTAL_CODE: String

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

Example: In forms that split the U.S. ZIP+4 Code with nine digits 99999-9999 into two fields annotate the delivery route code with this hint.

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

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

Value: "extendedPostalCode"

AUTOFILL_HINT_POSTAL_ADDRESS_LOCALITY

static val AUTOFILL_HINT_POSTAL_ADDRESS_LOCALITY: String

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

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

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

Value: "addressLocality"

AUTOFILL_HINT_POSTAL_ADDRESS_REGION

static val AUTOFILL_HINT_POSTAL_ADDRESS_REGION: String

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

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

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

Value: "addressRegion"

AUTOFILL_HINT_POSTAL_ADDRESS_STREET_ADDRESS

static val AUTOFILL_HINT_POSTAL_ADDRESS_STREET_ADDRESS: String

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

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

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

Value: "streetAddress"

AUTOFILL_HINT_POSTAL_CODE

static val AUTOFILL_HINT_POSTAL_CODE: String

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

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

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

Value: "postalCode"

AUTOFILL_HINT_SMS_OTP

static val AUTOFILL_HINT_SMS_OTP: String

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

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

When annotating OTP code fields which map to a single digit of the code consider using generateSmsOtpHintForCharacterPosition

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

Value: "smsOTPCode"

AUTOFILL_HINT_USERNAME

static val AUTOFILL_HINT_USERNAME: String

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

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

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

Value: "username"

Public methods

generateSmsOtpHintForCharacterPosition

@NonNull static fun generateSmsOtpHintForCharacterPosition(characterPosition: Int): 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).

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

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

Parameters
characterPosition Int: value between 1 and 8 representing the character position of the OTP code that the service should autofill in the associated view.