tags:

views:

56

answers:

1

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?

+4  A: 

Most likely you need to add an import declaration

Like:

import android.database.Cursor;
OscarRyz
Thanks. I just let eclipse do the work. Right-clicked the error and had it import the proper classes.
LuxuryMode
That and import android.widget.SimpleCursorAdapter; apparently
LuxuryMode
You could just hit Ctrl+Shift+O to import all the necessary packages if you're using eclipse.
SteD