title: attempt to reopen an already-closed object: sqlitequery
body: <p>So essentially I am querying the DB twice. I don't understand where this error is really coming from because I am not closing the DB anywhere. The code that returns the error runs like this. I've checked around and I just having seen a case like mine.</p>
  
  <pre><code>BeaconHandler pullAllDB = new BeaconHandler(this);
      try {
          List&lt;Beacon&gt; beaconsShown = pullAllDB.getAllBeacons();
          for (final Beacon bn : beaconsShown) {
              try {
                  int messageCount = pullAllDB.getMessageCount();
                  Log.d("Message", messageCount + " Messages Found");
                  if (messageCount &gt; 0) {
                      //Do Something
                  } else {
                      // Do Nothing
                  }
              } 
              catch (Exception e) {
                  e.getStackTrace();
                  Log.e("Message", e.getMessage());
              }
          }
      }
  </code></pre>
  
  <p>And the code doing the queries...</p>
  
  <pre><code>public int getBeaconsCount() {
  
      String countQuery = "SELECT * FROM " + TABLE_BASIC_BEACON;
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(countQuery, null);
      cursor.close();
  
      // return count
      return cursor.getCount();
  
  }
  
  public int getMessageCount() {
  
      String mcountQuery = "SELECT * FROM " + MESSAGE_BEACON;
      SQLiteDatabase mdb = this.getReadableDatabase();
      Cursor mcursor = mdb.rawQuery(mcountQuery, null);
      mcursor.close();
  
      // return count
      return mcursor.getCount();
  
  }
  </code></pre>