I'm having serious problems trying to get SQLite working with Android. I keep getting errors such as "unknown error (code 14): Could not open database".
One method I found that gets rid of this error temporarily is to delete the database and then create one. There mightn't even be a database but calling deleteDatabase() seems to fix the problem.
File DB_PATH = getApplicationContext().getDatabasePath("test.db");
DB_PATH.mkdirs();
DatabaseHelper dbh = DatabaseHelper.getHelper(this);
SQLiteDatabase db;
SQLiteDatabase.deleteDatabase(DB_PATH);
db = dbh.getWritableDatabase();
What I'm wondering is why would deleting the database make a difference and any advice in general would be appreciated?
Aucun commentaire:
Enregistrer un commentaire