Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compiler error: "Cursor cannot be resolved to a type"

Tags:

java

android

I'm messing around with the Notepad exercise 1. When I create 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?

like image 563
LuxuryMode Avatar asked Mar 10 '26 19:03

LuxuryMode


1 Answers

Most likely you need to add an import declaration

Like:

import android.database.Cursor;
like image 146
OscarRyz Avatar answered Mar 12 '26 07:03

OscarRyz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!