use of android.database.sqlite.SQLiteCantOpenDatabaseException in project Conversations by siacs.
the class DatabaseBackend method hasEnabledAccounts.
public boolean hasEnabledAccounts() {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("select count(" + Account.UUID + ") from " + Account.TABLENAME + " where not options & (1 <<1)", null);
try {
cursor.moveToFirst();
int count = cursor.getInt(0);
return (count > 0);
} catch (SQLiteCantOpenDatabaseException e) {
// better safe than sorry
return true;
} catch (RuntimeException e) {
// better safe than sorry
return true;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
Aggregations