Home » Android » android – Default dictionary missing on AutoCompleteTextView/MultiAutoCompleteTextView

android – Default dictionary missing on AutoCompleteTextView/MultiAutoCompleteTextView

Posted by: admin June 15, 2020 Leave a comment

Questions:

We have a chat app for which we recently implemented native android keyboard. Further in addition to this we are implementing multiple autocomplete using MultiAutoCompleteTextView. Thiscan done by creating a custom tokenizer using the standard procedure as mentioned in Android Docs

Everything seems to be working fine except for one issue that on converting EditText to MultiAutoCompleteTextView or AutoCompleteTextView android dictionary suggestions stop appearing. Being a chat app it is of utmost importance to our users that we show dictionary suggestions.

There are couple of other people who have posted similar question but they I think dint receive much community attention.
AutoCompleteTextView doesn't show dictionary suggestions

On the contrary one post on StackOverflow suggests that he is able to see dictionary suggestions asking for way to disable it.
AutoCompleteTextView without dictionary hints

Following some suggestions I added

android:inputType="textAutoCorrect"

but that too wasn’t of any help.

I have to simple questions:

  1. Is it possible to have dictionary in AutoCompleteTextView or MultiAutoCompleteTextView?

  2. In case this is possible, how to do it?

Thanks in advance.

How to&Answers:

You should set the key listener with autocomplete. It looks like AutoCompleteTextView ignores the xml “autocomplete” value, so you can do this programatically.

I do this after the AutoCompleteTextView has been created and works for me. You need to specify a Capitalize, usually NONE.

TextKeyListener input =
    TextKeyListener.getInstance(true, TextKeyListener.Capitalize.NONE);
myAutoComleteTextView.setKeyListener(input);

Answer:

I doesn’t make any sense to have the dictionary in an autocompletetextview. The user can select suggestions that appear with the view. If at all this is even possible, the user will see suggestions at two places which will be confusing.