database - [android]How to add new column to DB on missing one? -


i wrote application in android using db. in next version want add new column db without re-installing application. how can upgrade table on missing column exception?

you can changing(increment) database version

public class databas extends sqliteopenhelper {   private static final int database_version = 2; database(context context) {     super(context, database_name, null, database_version); }   public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {   if(oldversion <= database_version)         db.execsql("//write table altering query here ");     oncreate(db);   } 

increment database version value 1 current database version value


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -