java - Couldn't read row 384, col 47 from CursorWindow. Make sure the Cursor is initialized correctly -
i'm reading data android calendar , got strange crash reports users like:
java.lang.illegalstateexception: couldn't read row 384, col 47 cursorwindow. make sure cursor initialized correctly before accessing data it. my code here (bold line app crashes):
cursor eventcursor = contentresolver.query (builder.build(), null, calendarcontract.instances.calendar_id + " in (" + ids + ")", null, null); if (eventcursor == null) return true; while (eventcursor.movetonext()) { //this line causecrash ... something... } why happens? can't simulated. never ever happened me , can't understand reason nor error message.
in beginning of iteration use eventcursor.movetofirst() move first row. may use this:
if (eventcursor != null) { //start beginning eventcursor.movetofirst(); // loop on rows while (eventcursor.movetonext()) { // somehing here } } you can check whether cursor has rows or not using eventcursor.getcount().
Comments
Post a Comment