8

I would like to disable auto-complete and auto-correct in my editText field. I found this solution which disabled everything:

this.setInputType(this.getInputType() | EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | EditorInfo.TYPE_TEXT_VARIATION_FILTER);

That is fine but now I need to change my keyboard from normal alpha numeric to email. Unfortunatelly function above removes this option. When I remove parameter EditorInfo.TYPE_TEXT_VARIATION_FILTER, I can set an email keyboard but auto-complete is back as well.

How can I disable auto-correct/complete and have email keyboard at the same time?

THC
  • 233
  • 5
  • 12
mamakurka
  • 480
  • 1
  • 4
  • 14
  • Check this thread : http://stackoverflow.com/questions/1959576/turn-off-autosuggest-for-edittext – Yacino May 27 '15 at 13:07

3 Answers3

8

Try this... Add to your xml.

     android:inputType="textNoSuggestions"
Ram
  • 2,532
  • 4
  • 22
  • 25
4

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"

Check this link too:

Android programmatically disable autocomplete/autosuggest for EditText in emulator

Community
  • 1
  • 1
Goofy
  • 6,098
  • 17
  • 90
  • 156
0

To turn off auto-complete and auto-suggestions on EditText (SearchView etal.) programmatically:

editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
Isaac Riley
  • 290
  • 4
  • 5