Difference between android:hint and android:autofillHints in EditText

Viewed 2937

I am unable to understand if there is any difference between

android:hint

and

android:autofillHints

in EditText

I have the following code -

android:hint="@string/enter_name"
android:autofillHints="@string/enter_name"

What is the difference here in the two lines?

2 Answers

android:hint is more like a placeholder that sort of explains what type of input the EditText is asking for. i.e. If an EditText is asking for posting a status on social media, the hint like What's on your mind? will be suitable. enter image description here

android:autofillHints is to give actual values to the user to input in the EditText. Much like simulating a task for the user to think of a value to put inside the input field. The Autofill process requires more steps though as you also need to consider many things, like formatting the date. enter image description here

android:hint means Hint text to display when the text is empty.

android:autofillHints means it describes the content of a view so that a autofill service can fill in the appropriate data. Multiple hints can be combined in a comma separated list or an array of strings to mean e.g. emailAddress or postalAddress. To know more about autofill service see this

Related