4

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.

Rhyono
  • 2,420
  • 1
  • 25
  • 41

3 Answers3

7

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.

Rotemmiz
  • 7,933
  • 3
  • 36
  • 36
  • I suppose I wasn't clear enough: I tried all of those individually. – Rhyono Feb 08 '12 at 22:36
  • 2
    I kept looking for ways to make it work, and since I failed to do so, I went with your suggestion of using textVisiblePassword. – Rhyono Feb 09 '12 at 02:31
  • This doesn't work. Autosuggestion box still remains there. And textVisiblePassword hides emoji box, not good. – coolcool1994 May 11 '21 at 00:00
3

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);
voghDev
  • 5,641
  • 2
  • 37
  • 41
  • I tried different combinations for the xml attributes and none of them were working. Apparently setting it programatically is the only way to get it working for some devices or at least for my custom EditText. Thanks. – JCarlosR Dec 14 '20 at 17:16
0

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

Happy coding :)

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31063401) – tomerpacific Feb 20 '22 at 12:33