Search code examples
androidandroid-fragmentsfragmentandroid-fragmentactivitysimplecursoradapter

can't call construtor SimpleCursorAdapter in Fragment


why i can't call SimpleCursorAdapter in Fragment project, this my code :

    private void fillData() {
    Cursor notesCursor = mDbHelper.fetchAllNotes();
    getActivity().startManagingCursor(notesCursor);

    String[] from = new String[] { NotesDbAdapter.KEY_TITLE ,NotesDbAdapter.KEY_DATE};
    int[] to = new int[] { R.id.text1 ,R.id.date_row};

    SimpleCursorAdapter notes =
            new SimpleCursorAdapter(this, R.layout.note_row, notesCursor, from, to);
        setListAdapter(notes);
    }

thanks, please help me, cause because I'm chasing deadline


Solution

  • SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) is depricated in lvl 11. Use SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags). If you want develop application under lvl11 use

    android.support.v4.widget.SimpleCursorAdapter