in my dbHelper:
onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
function I save one table to an external database.
Therefore I
- attach and copy to the external database
- delete the db file in this function and copy it from external
- restore from external database to db.
this works until the function returns to getWritableDatabase()
Here I get this exception:
java.lang.IllegalStateException: no transaction pending
What is wrong? Thanks
Tata
The issue is that the
onUpgrademethod (as well asonCreate) occurs within a transaction, and at the end sets the transaction to be successful and ends it.However, you have already ended the transaction in
onUpgrade, resulting in this error.Relevant code from
SQLiteOpenHelper: