代码之家  ›  专栏  ›  技术社区  ›  LuxuryMode

编译器错误:“游标无法解析为类型”

  •  3
  • LuxuryMode  · 技术社区  · 14 年前

    我在做记事本练习1。当我创建fillData方法时,我得到一个错误“游标无法解析为类型”

    这是我的代码:

    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文件顶部的cursor类吗?如果是,怎么做?

    1 回复  |  直到 14 年前
        1
  •  7
  •   OscarRyz    14 年前

    很可能您需要添加 import 宣言

    import android.database.Cursor;