Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default dictionary missing on AutoCompleteTextView/MultiAutoCompleteTextView

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.

like image 742
karora Avatar asked Aug 17 '12 07:08

karora


1 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);
like image 124
Luis BJ Avatar answered Nov 06 '22 21:11

Luis BJ