Targeting Android 2.2
I have read the answers to the following questions:
Turn off autosuggest for EditText?
Android: Multiline & No autosuggest in EditText
I have tried the following variations on the suggestions:
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER);
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_VARIATION_FILTER);
setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
All of these work on most devices I've been testing (Droid X, Droid 2, Thunderbolt, Incredible) but don't work on the emulator and at least 1 device (Samsung GT i5500).
Is there any other way to programmatically disable the autocomplete/autosuggest for an EditText in a way the emulator and certain devices will recognize and respect?
personally, this code help me:
I want to disable suggestions when I set text so I remove the adapter and after I call
setText
, I return it.so if you want to disable suggestion just use:
You can use the class AutoCompleteTextView and set the adapter that contains nothing AutoCompleteTextView Class Reference
example
Using
android:inputType="textNoSuggestions|textVisiblePassword"
for Edittext fix the problem.I was fighting with the same problem in the emulator. While testing, I realized that what was appearing wasn't the normal autocomplete, but a special Asian character preview (presumably because it requires multiple keys to generate one Asian character). So I solved this by setting the language to English. I think what I was seeing was the "Key Preview" option listed under the "Japanese IME" setting in "Language & keyboard".
I'm guessing that it would be pretty hard to disable this within an individual App without delving into the keyboard handling and language support.
I've tried all the above and none of above really helped me. I've search through available InputTypes and I've came up with a solution, which happened to be TYPE_TEXT_FLAG_AUTO_COMPLETE:
mEditText.setInputType(InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
From its description:
I haven't specified any completions set and as a result I'm not getting any auto-suggestions.
PS. Flag
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
mentioned in commend above does this trick as well, but it also disables toggling the language in the keyboard.You can also use following for disabling auto suggestion on any edittext.
This worked for me.