CQM
CQM

Reputation: 44278

android EditText what inputType to avoid text suggestions

one of my biggest peeves is how some android keyboards make text suggestions come up with no way to hide the keyboard. I think this has something to do with the kind of editable field is being focused.

What inputType will make this never happen? I never want to see android word suggestions when I am trying to have a user log in, for instance.

Upvotes: 1

Views: 2588

Answers (2)

Varun Bhatia
Varun Bhatia

Reputation: 4396

If you want to do it programmatically, then you can use the following code to avoid text suggestions on all keyboard types.

//assume an EditText object with name myEditText
myEditText.setInputType(myEditText.getInputType() | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS does not seem to work as expected on all keyboards whereas InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD has the drawback that it also disables toggling the language in the keyboard and the swipe gesture to add the text.

Upvotes: 2

Related Questions