Rhyono
Rhyono

Reputation: 2468

Disable suggestions for EditText

What I have tried:

specifying the inputType for the EditText on the main.xml page as...

textFilter
text|textNoSuggestions 
textNoSuggestions

In the java file in the onCreate

EditText hex = (EditText) findViewById(R.id.editHex);
hex.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

I'm running this on an emulator using API 13.

Upvotes: 4

Views: 7398

Answers (3)

A_R Rehman
A_R Rehman

Reputation: 11

This actually works for me when i put: android:importantForAutofill="no" in editText field.

Happy coding :)

Upvotes: -1

voghDev
voghDev

Reputation: 5791

In my case, android:inputType="textNoSuggestions" worked in Android 5+ phones, but for Android 4 I had to set visible password via code, using this method:

editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);

Upvotes: 3

Rotemmiz
Rotemmiz

Reputation: 7973

This worked for me after a long struggle... Use just android:inputType="textFilter", and remove the hex.setInputType() , it replaces what you configured in your XML at runtime.

If it still doesn't work you can always try the dirty trick of android:inputType="textVisiblePassword", but I strongly suggest that you give android:inputType="textFilter" another try.

Upvotes: 7

Related Questions