Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android programmatically disable autocomplete/autosuggest for EditText in emulator

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?

like image 405
gyoda Avatar asked Jun 08 '11 15:06

gyoda


People also ask

How do I turn off Autocomplete on Android?

Users can enable or disable autofill as well as change the autofill service by navigating to Settings > System > Languages & input > Advanced > Input assistance > Autofill service.

What is EditText control?

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.

How do I set autocomplete text on Android?

If you want to get suggestions , when you type in an editable text field , you can do this via AutoCompleteTextView. It provides suggestions automatically when the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.


2 Answers

For Vodafone 845 (2.1), huawei 8800 (2.2) devices, textVisiblePassword seems to prevent word prediction.

vendorId.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 

or

android:inputType="textVisiblePassword" 

[Edit] this answer is quite old and I don't have the environment anymore to test to get up-to-date info for comments here, sorry.

like image 104
bob Avatar answered Sep 28 '22 06:09

bob


In the layout XML, add the following attribute to your EditText:

android:inputType="text|textNoSuggestions" 

If neither this, nor the above approaches work, then this is almost certainly a problem with the emulator and the other device, and you should contact the manufacturers directly.

See also: android:inputType (note that EditText is a subclass of TextView, which is why this attribute also works for EditTexts).

like image 39
Phil Avatar answered Sep 28 '22 06:09

Phil