4

It seems like there is no way to enable auto-correction with the autocompletetextview and the multiautocompletetextview in Android.

  1. Auto-correction works perfectly with the standard EditText.
  2. As soon as an Autocompletetextview or a Multiautocompletetextview is used, auto-correction ceases to work.

I've already tried a bunch of potential workarounds but none of them is working (i.e. using the various input options in the XML file).

Has anyone been able to successfully enable auto-correction on an Autocompletetextview or a Multiautocompletetextview and still be able to feed a list of suggestion to it as an Adapter? Thanks much!

Joseph Lam
  • 5,289
  • 3
  • 14
  • 13

1 Answers1

9

autocompletetextview will set InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE flag on the input view.

That flag make some IME stop giving auto correct suggestions.

You can extend AutoCompleteTextView and remove the flag like below

public SocialCompleteTextView(Context context) {
    super(context);
    int removed = this.getInputType() & (this.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
    this.setInputType(removed);
}
CodeChimp
  • 4,745
  • 6
  • 45
  • 61
ksc91u
  • 520
  • 2
  • 6