attempt to write a readonly database in Android2.1

Posted by JoJo on Stack Overflow See other posts from Stack Overflow or by JoJo
Published on 2010-05-15T05:08:48Z Indexed on 2010/05/15 5:14 UTC
Read the original article Hit count: 150

Filed under:
|

This is the error:

android.database.sqlite.SQLiteException: attempt to write a readonly database

This is my code:

SQLiteDatabase db = mDatabase.getWritableDatabase();
db.beginTransaction();
try {
   // add new records
   ContentValues newRecord = new ContentValues();
   newRecord.put(Emergencydetails.EMERGENCYNUMBER, emergencyNumber.getText().toString());
   db.insert(Emergencydetails.EMERGENCY_TABLE_NAME, null, newRecord);
   db.setTransactionSuccessful();
} finally {
db.endTransaction();
}

© Stack Overflow or respective owner

Related posts about android

Related posts about database