按照本教程,在 SimpleCursorAdapter 中遇到光标问题。在教程示例中按预期工作。在我的代码中,它显示错误“构造函数 SimpleCursorAdapter 未定义”。不知道什么是未定义的。代码如下所示:
Cursor cursor = null;
if (inputText == null || inputText.length() == 0) {
cursor = myDataBase.query(true, GL_TABLE, new String[] { GL_ID,
GL_FK, GL_LANG, GL_VALUE}, GL_FK
+ " like '%" + inputText + "%'", null, null, null, null,
null);
} else {
cursor = myDataBase.query(true, GL_TABLE, new String[] { GL_ID,
GL_FK, GL_LANG, GL_VALUE}, GL_VALUE
+ " like '%" + inputText + "%'", null, null, null, null,
null);
}
if (cursor != null) {
cursor.moveToFirst();
}
String[] columns = new String[] { GL_FK, GL_LANG, GL_VALUE};
int[] to = new int[] { R.id.tvWord, R.id.tvMeaning, R.id.tvKanji};
dataAdapter = new SimpleCursorAdapter(this, R.layout.listword,
cursor, columns, to, 0);