title: Activity life cycle and database confusion
body: <p>I have an activity where I am opening an database by calling constructor of SQLiteOpenHelper.</p>
  
  <pre><code>dbHelper = new DBHelper(this); //DBHelper class extends SQLiteOpenHelper
  </code></pre>
  
  <p>Then on click of a button I am opening another activity and closing the dbHelper.</p>
  
  <pre><code>int cuisineId = HelperUtils.getCuisineIdByName(dbHelper,cuisine);
  SingletonGlobalClass.getInstance().setCuisineId(cuisineId);
  String restaurantNameSearchStr = restaurantName.getText().toString().trim();
  Intent intent = new Intent();
  intent.setComponent(new ComponentName("ctnxa.android", ctnxa.android.SearchResultActivity"));
  intent.putExtra("searchStr", restaurantNameSearchStr);
  intent.putExtra("option", R.string.restaurant);
  startActivity(intent);
  dbHelper.close();
  </code></pre>
  
  <p>Now when I am pressing back button it comes back to this activity. When I am trying to click the search button again it uses the dbHelper and works as usually without any error. My expectation is it should not work as the dbHelper has already been closed before and it can only be re-instantiated when activity onCreate() method is called which is not getting called in this case as I am only pressing back button (It should call onResume()). I am really confused. Could any body explain what is happening here.</p>
  
  <p>Edit: This is how I have implemented dbHelper.close()</p>
  
  <pre><code>@Override
  public synchronized void close() {
      super.close();
  }
  </code></pre>