vendredi 17 juillet 2015

Android DBHelper Upgrade

I have a mozilla sqlite for my android App. in the sqlite manager on my firefox, i'm add a row to my table.and when i run program, the database not updated.

so i change my oncreate and upgrade method as bellow:

   @Override
public void onCreate(SQLiteDatabase db) {


    db.execSQL("CREATE TABLE Db_City");

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    db.execSQL("DROP TABLE IF EXIST Db_City");
    onCreate(db);

}

and change the version of my database.

but when i run the program again all of my data in app is missing.

can anybody help me to exactly what to do? tanks.

Aucun commentaire:

Enregistrer un commentaire