Android: unable to update read-only database from version 0 to 1


I know that there are many topics that have the same name, but I tried them all. I could not solve my problem.
The error I am getting is this: android.database.sqlite.SQLiteException: it is not possible to update a read-only database from version 0 to 1: /data/data/com.halilkaya.flashcard/databases/flashcarddb.db

Actually, it works on the emulator, but when I install it on my phone, it does not work!

+3
source share
3 answers

Hope you reset the table and update it as below

public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + LOCATION_TABLE);
    db.execSQL("DROP TABLE IF EXISTS " + PHONE_TABLE);
    // Create tables again
    onCreate(db);

}
+4
source

, sql logcat ( HTC OneX , ). . , " ".

0

, onclick .

public class disp_emails_sent extends Activity

......
protected void onCreate(Bundle bd) 
    {
        super.onCreate(bd);
        setContentView(R.layout.disp_db_res);

        lv = (ListView) findViewById(R.id.myEmail_list);

        List<String> arrayL = new ArrayList<String>();
        db_handler dbHand = new db_handler(disp_emails_sent.this);

(disp_emails_sent.this), , , . this.getApplicationContext() , .

, , .

, , .

I would like to explain if anyone has this.

0
source

All Articles