Turn off autosuggest for EditText?

Ways to do it:

  1. Programatically
editText.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
  1. XML
android:inputType="textNoSuggestions"

If you already have some flags set, then:

  1. Programatically
inputType = if (disableSuggestions) {
  InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS or inputType
} else {
  inputType and InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS.inv()
}
  1. XML
android:inputType="textNoSuggestions|textPassword"

android:inputType="textVisiblePassword" 

works like a charm


I had the same question but I still wanted to set this option in my XML file so I did a little more research until I found it out myself.

Add this line into your EditText.

android:inputType="textFilter" 

Here is a Tip. Use this line if you want to be able to use the "enter" key.

android:inputType="textFilter|textMultiLine"

android:inputType="textNoSuggestions"  

also you'd better read this