Here is an easy way to find the suggestions:
Spannable str = myEditText.getText();
SuggestionSpan[] spanned = str.getSpans(startIndex, endIndex, SuggestionSpan.class);
If spanned
is not empty, there is an error in the text between startIndex
and endIndex
. By changing the values of these indices, it will be possible to find which word is erroneous. Each item in the spanned array has a field called mSuggestions
, which is an array of strings and provides the suggested words for the erroneous word.