title: I'm getting a Database Object Not Closed Exception in SQLite (Android), but I'm explicitly closing my database... Help?
body: <p>Here is the error:</p>
  
  <p><em>02-08 16:35:00.899: ERROR/Database(468): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here</em></p>
  
  <p>Except, well, I am. Here is the method where this problem is occuring:</p>
  
  <pre><code>    public static void getUpdates(String username, Context context) {
      HttpClient httpClient = new DefaultHttpClient();
      HttpPost httpPost = new HttpPost("http://10.0.2.2/tag/appgetfriendinfo.php");
  
      try {
          List&lt;NameValuePair&gt; nVPs = new ArrayList&lt;NameValuePair&gt;();
          nVPs.add(new BasicNameValuePair("username", username));
  
          httpPost.setEntity(new UrlEncodedFormEntity(nVPs));
          HttpResponse response = httpClient.execute(httpPost);
  
          ResponseHandler&lt;String&gt; rHandler = new BasicResponseHandler();
          String result = rHandler.handleResponse(response);
  
          JSONArray jArray = new JSONArray(result);
          for(int i = 0; i &lt; jArray.length(); i++) {
              JSONObject jObj = jArray.getJSONObject(i);
              String userCheck = jObj.getString("username");
              TagDBAdapter dbHelper = new TagDBAdapter(context);
              dbHelper.open();//OPENING THE DATABASE
              Contact contact = new Contact();
  
              String first = jObj.getString("firstname");
              String last = jObj.getString("lastname");
              String name = first + " " + last;
  
              contact.setUsername(jObj.getString("username"));
              contact.setFirstName(first);
              contact.setLastName(last);
              contact.setName(name);
              contact.setPhoneNumber(jObj.getString("phonenumber"));
              contact.setEmail(jObj.getString("email"));
              contact.setHomePhone(jObj.getString("homephone"));
              contact.setWorkPhone(jObj.getString("workphone"));
  
              if(dbHelper.checkForExisting(userCheck) == true) {
                  dbHelper.createContact(contact);
              }
              else {
                  dbHelper.updateContactAuto(userCheck, contact);
              }
              dbHelper.close();//CLOSING THE DATABASE
          }
  
      } catch(ClientProtocolException e) {
          Log.e("GETUPDATES", "CPE", e);
          e.printStackTrace();
      } catch(IOException e) {
          Log.e("GETUPDATES", "IOE", e);
          e.printStackTrace();
      } catch(JSONException e) {
          Log.e("GETUPDATES", "JSONE", e);
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>As you can see on the lines I noted in //comments, I am opening AND closing the database, yet I am still getting the error. Here is what is strange though, the error's source is in the SQLite's open() method.</p>
  
  <p><em>ERROR/Database(468): at com.tagapp.android.TagDBAdapter.open(TagDBAdapter.java:62)</em></p>
  
  <p>Which is this:</p>
  
  <pre><code>    /**THESE ARE MY DBADAPTER'S OPEN AND CLOSE METHODS*/
  
      public TagDBAdapter open() throws SQLException {
      mDBHelper = new DatabaseHelper(m_context);
      mDb = mDBHelper.getWritableDatabase();
      return this;
  }
  
  public void close() {
      mDBHelper.close();
  }
  </code></pre>
  
  <p>These are straight from Google's notepad tutorial, and they have worked 100% for me in different instances. Does anyone have an idea of what is going on here? Thanks a lot.</p>