Also it never happened on any of my devices, I am receiving quite a lot crash reports from customers like:
java.lang.IllegalStateException: attempt to re-open an already-closed object
Crashes always happens on db.query line (7th line of code):
ArrayList<AlarmItem> items = new ArrayList<AlarmItem>();
SQLiteDatabase db = null;
Cursor cursor = null;
try {
db = instance.getReadableDatabase();
// CRASH next line:
cursor = db.query(TABLE_ALARMS, null, null, null, null, null, null);
...
}
} catch (SQLiteException ex) {
...
} finally {
if (cursor != null)
cursor.close();
if (db != null)
db.close();
}
return items;
Anybody know what can be the reason? Thanks!
EDIT:
All methods are synchronized, so there can't be more than 1 operation in a moment. Instance is a singleton, so it shouldn't be problem.