attempt to write a readonly database in Android2.1
This is the error:
android.database.sqlite.SQLiteException: attempt to write a readonly database
This is my code:
SQLiteDatabase db = mDatabase.getWritabl开发者_JAVA技巧eDatabase();
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();
}
I have solved this. I have just shortened the table name. That's it.
精彩评论