i have a table MY_DATABASE_TABLE .. but i want to know if it exists or not
public boolean checkDataBase() {
SQLiteDatabase checkDB = null;
try {
checkDB = SQLiteDatabase.openDatabase(MY_DATABASE_NAME, null,
SQLiteDatabase.OPEN_READONLY);
checkDB.close();
} catch (SQLiteException e) {
// database doesn't exist yet.
}
return checkDB != null ? true : false;
}
the above code didn’t worked and always returned false
1 Answer