我正在开发 Android 应用程序。我正在尝试显示用户输入,但是当我尝试这样做时,我收到了上述错误消息。我不知道我做错了什么。这是我使用的代码。谢谢你。
try {
Cursor cursor = dictionary.getDictionaryDatabase().rawQuery("SELECT catgram FROM adresse_definition WHERE definition='"+word[0].toLowerCase().trim()+"'", null);
//Cursor cursor = dictionary.getDictionaryDatabase().rawQuery("SELECT index_nom_adresse" + word[0].toLowerCase().trim() + " FROM adresse_definition JOIN definition ON adresse_definition.definition = definition.data_id ", null);
//Cursor cursor = dictionary.getDictionaryDatabase().query("adresse_definition", null, "index_nom_adresse= '" + word[0].toLowerCase().trim() + "' or definition= '" + word[0].toUpperCase().trim() + "' ", null, null, null, null);
cursor.moveToFirst();
if (cursor.getCount() != 0) {
if (word[1] == null || word[1].equals("English")) {
translatedWord = cursor.getString(2);
} else {
translatedWord = cursor.getString(1);
}
} else {
translatedWord = "The word is not in database";
}
cursor.close();
} catch (SQLiteException sqle) {
translatedWord = "The word is not in database";
}
dictionary.close();