From comments:
154 line is cursor.close();
Cursor cursor = null;
//...
try {
cursor = db.rawQuery(queryString, null);
} catch (Exception e) {
e.printStackTrace();
} finally {
cursor.close();
}
In case there was an exception, cursor
is null
and attempting to call a method on it results in NPE. Either move the cursor.close()
in the try
block, or surround it with if (cursor != null)
condition.
Why rawQuery()
throws is if there is an SQL syntax problem. To get help with that, post the exception for the exception you log in the catch
block.