jeudi 5 mai 2016

Android Cursor initialization

   Cursor cursor =database.query(ColumnID.AGENT_TABLE,null,null,null,null,null,null);

    while (cursor.moveToNext()) {
        County county = new County();
        county.setId(cursor.getString(cursor
                .getColumnIndex(ColumnID.ID)));
        county.setAgent_Name(cursor.getString(cursor
                .getColumnIndex(ColumnID.AGENT_NAME)));
        county.setAddress_Line_1(cursor.getString(cursor
                .getColumnIndex(ColumnID.ADDRESS_LINE_1)));


        countyList.add(county);
    }

I'm getting error is:

Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

Aucun commentaire:

Enregistrer un commentaire