java.lang.illegalstateexception database not open android
android, sqlite
Solution
Try it like this:
if (!db.isOpen()) {
db = getApplicationContext().openOrCreateDatabase(DATABASE_PATH, SQLiteDatabase.OPEN_READWRITE, null);
}
Problem
When I am trying to insert to data base log cat shows an error like `java.lang.illegalstateexception database not open android.` But I have opened the db using ``` db = SQLiteDatabase.openDatabase(DATABASE_PATH, null, SQLiteDatabase.OPEN_READWRITE); ``` The error is not occurring frequently.Anybody know the reason for this?