I have designed a database. Here is my code:
  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);
        }
Unfortunately, I'm getting this error:
 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.
Reference: Android Cursor initialization
 
     
     
    