I had faced a different flavour of the same problem.
I was getting no such table
error when I try to insert.
Before inserting, the code was calling
mDb = mDbHelper.getWritableDatabase();
getWritableDatabase()
, when called first time will call onCreate()
I had my SQL query to create the table within this oncreate method
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
Log.v("INFO1","creating db");
//Toast.makeText(mCtx, "created", Toast.LENGTH_SHORT).show();
}
So for me what had happened was, the db
was successfully created when the application was first run but no table due to some other errors.
Later whenever the application is run, onCreate()
is never called as db
is already there and thus no table created, so all further SQL commands failed.
So I moved creating table out of onCreate()
, and now its working