【发布时间】:2014-10-30 11:30:08
【问题描述】:
如何在android中使用Google dictionary检查拼写?
我想知道我输入的单词是否正确。
它应该从Google dictionary检查。
如果单词正确,则应显示在 toast 中,否则不应显示
【问题讨论】:
标签: android android-layout dictionary toast android-toast
如何在android中使用Google dictionary检查拼写?
我想知道我输入的单词是否正确。
它应该从Google dictionary检查。
如果单词正确,则应显示在 toast 中,否则不应显示
【问题讨论】:
标签: android android-layout dictionary toast android-toast
@Override
public void onGetSuggestions(final SuggestionsInfo[] arg0) {
final StringBuilder sb = new StringBuilder();
boolean isSpellCorrect = false;
for (int i = 0; i < arg0.length; ++i) {
// Returned suggestions are contained in SuggestionsInfo
final int len = arg0[i].getSuggestionsCount();
if(editText1.getText().toString().equalsIgnoreCase(arg0[i].getSuggestionAt(i)))
{
isSpellCorrect = true;
Toast.makeText(this, "Entered word is correct", Toast.LENGTH_LONG).show();
break;
}
}
}
在整个项目中使用这个link,只需在上述方法中进行更改即可。
【讨论】: