I'm messing around with the Notepad exercise 1. When I creat开发者_JAVA百科e the fillData method, I get an error that "Cursor cannot be resolved to a type"
Here's my code:
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);
}
Do I need to import the cursor class at the top of my java file? If so, how?
Most likely you need to add an import
declaration
Like:
import android.database.Cursor;
精彩评论