how do i add new tables to a database on the android platform?

The big question now is where do you call the creation of the new table? If you do this in

public void onCreate(SQLiteDatabase db)

Your code won’t be executed, as the database already exists!

To properly handle that, add it to

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

And then change the version of your Database to a higher number. When you restart the app it will see a new version and run onUpgrade.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top