App crashes upgrading sqlite database first time App crashes upgrading sqlite database first time sqlite sqlite

App crashes upgrading sqlite database first time


You don't need to delete the database, just copy over it using the method you've alady defined (copyDataBase), like this:

@Override  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {      Toast.makeText(myContext, "onUpgrade called!", Toast.LENGTH_LONG).show();      if (oldVersion < newVersion) {          Log.v("Database Upgrade", "Database version higher, upgrading");          try {             copyDataBase();         } catch (IOException e) {             throw new Error("Error upgrading database");         }     } }