Skip to content Skip to sidebar Skip to footer

IllegalStateException: Couldn't Read Row 0, Col -1 From CursorWindow

IllegalStateException: couldn't read row 0, col -1 from cursorWindow. I am new to android I looked at smiller question did solve my problem help please Thanks in advance. here my c

Solution 1:

The column name you gave does not exists.

getColumnIndex(String columnName)

Returns the zero-based index for the given column name, or -1 if the column doesn't exist.
Error lies in any of the following parts of your code:

c.getString(c.getColumnIndex("Expense_Category ")); //notice the space after Expense_Category
c.getString(c.getColumnIndex("Amount"));
c.getString(c.getColumnIndex("PaymentType"));
c.getString(c.getColumnIndex("Date"));

If you expect the column to exist use getColumnIndexOrThrow(String) instead, which will make the error more clear.


Post a Comment for "IllegalStateException: Couldn't Read Row 0, Col -1 From CursorWindow"