НК
* @param ctx - контекст
* @return - true/false
*/
public boolean checkDataBase(Context ctx) {
SQLiteDatabase checkDB = null;
try {
String dbPath =getDbPath(ctx);
Log.d(LOGTAG, "checkDataBase=" + dbPath);
File file = new File(dbPath);
if (file.exists() && !file.isDirectory()) {
checkDB = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READONLY);
}
} catch (SQLiteException e) {
Log.d(LOGTAG, e.getMessage());
}
if (checkDB != null) {
checkDB.close();
return true;
}
else {
return false;
}
}