title: Not closing cursor or database object?
body: <p>I get this error after going to this activity, starting a new one, coming back. It doesn't happen when I first load the activity. functionally everything works... but I still get this error.</p>
  
  <blockquote>
    <p>ERROR/Cursor(1059): Finalizing a
    Cursor that has not been deactivated
    or closed. database =
    /data/data/com.roger.testapp/databases/data,
    table = null, query = SELECT MAX(_id)
    FROM record</p>
    
    <p>03-02 16:47:21.835:
    ERROR/Cursor(1059):
    android.database.sqlite.DatabaseObjectNotClosedException:
    Application did not close the cursor
    or database object that was opened
    here</p>
  </blockquote>
  
  <p>In onCreate:</p>
  
  <pre><code>    mDbHelper = new CommonDbAdapter(this);
      mDbHelper.open();
      fillData();
  </code></pre>
  
  <p>fillData() calls fetchNote in my dbhelper, the cursor is used for a couple things, if rowId == 0, that means I didn't select an item to get into this activity and I want to get the last row in that table. if rowId = something else, then I grab that row. I think the problem is in here somewhere, I'm just not sure.</p>
  
  <pre><code>public Cursor fetchNote(long rowId, String table, String columns) throws SQLException {
      if (rowId == 0) {
          String query = "SELECT MAX(_id) FROM record";
          Cursor cursor = mDb.rawQuery(query, null);
          rowId = 0;     
          if (cursor.moveToFirst())
          {               
            rowId = cursor.getInt(0);                         
          }
      }
      Cursor mCursor =
          mDb.query(true, table, new String[] {KEY_ROWID,
                  columns}, KEY_ROWID + "=" + rowId, null,
                  null, null, null, null);
      if (mCursor != null) {
          mCursor.moveToFirst();
      }
      return mCursor;
  
  }
  </code></pre>
  
  <p>In onDestroy:</p>
  
  <pre><code>super.onDestroy();
      if (mDbHelper != null) {
          mDbHelper.close();
      }
  </code></pre>
  
  <p>Also, I am startManagingCursor</p>