title: onUpgrade database Android version number not increasing
body: <p>I am trying to update my database in my Android application. When I update the version number, onUpgrade gets called, but the version number doesn't increase, so every time I access the database, onUpgrade gets called. Here is my code:</p>
  
  <pre><code>private final static int DB_VERSION = 8;
  
          public DataBaseHelper(Context context) {
  
          super(context, DB_NAME, null, DB_VERSION);
          this.myContext = context;
      }   
          @Override
      public void onCreate(SQLiteDatabase db) {
          Log.d(TAG, "in onCreate");
          try {
              copyDataBase();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          Log.d(TAG, "in onUpgrade. Old is: " + oldVersion + " New is: " + newVersion);
          myContext.deleteDatabase(DB_NAME);
          Log.d(TAG, "the version is " + db.getVersion());
          db.setVersion(newVersion);
          Log.d(TAG, "the version is " + db.getVersion());
          onCreate(db);           
      }
  </code></pre>
  
  <p>Anyone know why this is happening?</p>