我正在尝试完成记事本练习1。当我创建fillData方法时,出现了一个错误,提示“无法将Cursor解析为类型”。
以下是我的代码:
private void fillData() {
//get notes from DB and create item list
Cursor c = mDbHelper.fetchAllNotes();
startManagingCursor(c);
String[] from = new String [] { NotesDbAdapter.KEY_TITLE };
int[] to = new int[] { R.id.text1 };
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
setListAdapter(notes);
}
我需要在我的Java文件顶部导入光标类吗?如果是,该怎么做?
import
实际上是一个声明(我曾经一度以为它也是一个语句)。https://dev59.com/PU3Sa4cB1Zd3GeqPwpxG - OscarRyzCursor c
下面有一条小红线,上下文菜单会告诉你该怎么做。 - Falmarri