Compiler Error: "The cursor cannot be resolved to type"

I was busy with the exercise "Notepad" 1. When I create the fillData method, I get the error message "The cursor cannot be resolved to type"

Here is 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 a cursor class at the top of my java file? If so, how?

+3
source share
1 answer

Most likely you need to add an ad import

Like:

import android.database.Cursor;
+7
source

Source: https://habr.com/ru/post/1771414/


All Articles