I have a bunch of EditTexts
in a registration Fragment.
On KitKat and below, any EditText
whose inputType
is an email address will use the system's autocomplete, which is convenient for users putting in their email addresses.
However, on Lollipop (5.0.1 on a Nexus 4, for what it's worth), it refuses to use autocomplete. Here is my code for setting up the input type:
mEditText.setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
| InputType.TYPE_TEXT_FLAG_AUTO_CORRECT));
The following code which is just capitalizing the first letter of each word rather than setting the input as an email address is causing AutoComplete to work on all API levels (even though the flag I'm setting is for AutoCorrect instead of AutoComplete):
mEditText.setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_FLAG_CAP_WORDS
| InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
which is extra-confusing, since looking at the docs for TYPE_TEXT_FLAG_AUTO_CORRECT, it looks like that should actually be disabling AutoComplete.
TL;DR: How in the hell do you enable auto-completion on a Lollipop EditText which you're expecting to get an email address?
Nick Butcher has a great post on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With