android.database.sqlite.SQLiteCantOpenDatabaseException Java Examples
The following examples show how to use
android.database.sqlite.SQLiteCantOpenDatabaseException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Database.java From OpenXiaomiScale with Apache License 2.0 | 6 votes |
private boolean existsDatabase() { SQLiteDatabase database = null; boolean isExist = true; try { database = SQLiteDatabase.openDatabase(DB_PATH, null, SQLiteDatabase.OPEN_READONLY); } catch (SQLiteCantOpenDatabaseException e) { // No database Log.d("Database", "Database not found!"); isExist = false; } finally { if ( database != null ) database.close(); } return isExist; }
Example #2
Source File: JobStorage.java From android-job with Apache License 2.0 | 6 votes |
@NonNull @VisibleForTesting /*package*/ SQLiteDatabase getDatabase() { if (mInjectedDatabase != null) { return mInjectedDatabase; } else { try { return mDbHelper.getWritableDatabase(); } catch (SQLiteCantOpenDatabaseException e) { CAT.e(e); // that's bad, delete the database and try again, otherwise users may get stuck in a loop new JobStorageDatabaseErrorHandler().deleteDatabaseFile(DATABASE_NAME); return mDbHelper.getWritableDatabase(); } } }
Example #3
Source File: AnalyticsDatabaseUnitTest.java From braintree_android with MIT License | 4 votes |
@Override public SQLiteDatabase getReadableDatabase() { throw new SQLiteCantOpenDatabaseException(); }
Example #4
Source File: AnalyticsDatabaseUnitTest.java From braintree_android with MIT License | 4 votes |
@Override public SQLiteDatabase getWritableDatabase() { throw new SQLiteCantOpenDatabaseException(); }