Home » Android » android – What is difference between 'textEmailAddress' and 'textWebEmailAddress'

android – What is difference between 'textEmailAddress' and 'textWebEmailAddress'

Posted by: admin April 23, 2020 Leave a comment

Questions:

I noticed that among other attributes, that we can specify for EditText as an inputType, there are two, that look similar:

  1. textEmailAddress
  2. textWebEmailAddress

Google doc has explained very less about this.

We can understand that textWebEmailAddress is something related to HTML or WebView, but I would like to know what exactly, the difference between the two is.

How to&Answers:

Here are some resources I’ve found regarding these two inputTypes:

… For example, textEmailAddress is a text field where the user will enter something that is an e-mail address ([email protected]) so the key layout will have an ‘@’ character in easy access…

This was found here.

And then:

…You can specify the type of keyboard you want for your EditText object with the android:inputType attribute. For example, if you want the user to input an email address, you should use the textEmailAddress input type…

This was found here.

And the only thing I can find on textWebEmailAddress is:

Variation of TYPE_CLASS_TEXT: entering e-mail address inside of a web form. This was added in HONEYCOMB. An IME must target this API version or later to see this input type; if it doesn’t, a request for this type will be seen as TYPE_TEXT_VARIATION_EMAIL_ADDRESS when passed through EditorInfo.makeCompatible(int).

This was found here.

From what I’ve seen in these sections, there is very little difference in the results, the keyboards are the same, just specified differently for different locations of inputs; one in a web form, one for general-purpose.

Also the textWebEmailAddress is only effective for Honeycomb and newer platforms, while the regular is compatible for all. Although both could be used in older versions, per the documentation, they would operationally be a regular textEmailAddress anyways.