JsonModel load cursor erro
Hey! Still getting error with cursor in load() in JsonModel class solved with:
if(cursor != null) {
if(cursor.moveToFirst()){
modelContainerAdapter.loadFromCursor(cursor, this);
cursor.close();
}
cursor.close();
}
instead of:
if(cursor != null && cursor.moveToFirst()) {
modelContainerAdapter.loadFromCursor(cursor, this);
cursor.close();
}
no clue what's going on...
@OptimistNot it appears a Cursor is left open? or that the Cursor cannot moveToFirst(). Which is strange. I wonder how that could fail?
Hmmm....found this today: http://stackoverflow.com/questions/30802132/do-i-need-to-close-a-cursor-if-movetofirst-is-false I suppose if cursor is not null but has no first to move the above condition (cursor != null && cursor.moveToFirst()) will fail...but you should close it anyway as it not null...no? In your load() method if query has no result it returns null? or something empty? Seems like empty but not null.
fixed in 3.0 by a try...finally cursor.close() so that any cursor will be closed.