title: SQLite DatabaseHelper class
body: <p>when we create SQLite database from an android application can use a DatabaseHelper class which extend SQLiteOpenHelper. </p>
  
  <p>My constructor is as follows</p>
  
  <pre><code>public DatabaseHelper(Context context)  
  {
        super(context, dbName, null, DATABASE_VERSION);  
  }
  </code></pre>
  
  <p>Then the onCreate() method</p>
  
  <pre><code>public void onCreate(SQLiteDatabase db) 
  {
      String qry = "CREATE TABLE DEPT(dept_id INTEGER PRIMARY KEY, deptName TEXT)";   
      db.execSQL(qry);
      InsertDepts(db); 
  }
  </code></pre>
  
  <p>But when i create an instance of the DatabaseHelper class, my database havent created yet.</p>
  
  <p>I believe when I create an Object from this class, the constructor executes and since no database created yet it will create database and execute onCreate() method. So definitely an database must be created.</p>
  
  <p>Or untill we execute the following code doesn't it execute the onCreate() method, even if we create an object from the class.</p>
  
  <pre><code>databaseHelper.getWritableDatabase()
  </code></pre>
  
  <p>Can anyone please explain the execution order of the databasehelper class.</p>