title: Returning list of objects from Database
body: <p>I am trying to return an object array from my database but can't get the call correct or the return object[s].
  In the example below I just return an empty String trying to get this working. The listings[cnt] are being filled properly but I'm not sure how to make the call and return the Objects?</p>
  
  <p>I am making 2 different calls to new Houses in getData() and that doesn't seem right either.</p>
  
  <p>Houses[] listings = new Houses[cnt]; // Seems like I need this to initialize the array to a certain size.
  listings[cnt] = new Houses(z,a,b,c,d,e,f,g,h); // Then I fill the Object with variables. </p>
  
  <p>then return listings somehow.</p>
  
  <pre><code>// ??? How do I set it up so that I get an array of objects back?
  // I am making the call from MainActivity here
  myHelper = new GrumpyDB(this);
      String h = new String();
      h = myHelper.getData();
  
  
  
  public String getData() {
      Log.d(TAG, "Starting getData");
      SQLiteDatabase db = helper.getWritableDatabase();
      String[] columns = {myHelper.UID, myHelper.ADDRESS, myHelper.STREET, myHelper.CITY, myHelper.STATE, myHelper.ZIP, myHelper.ENTIRE_ADDRESS,myHelper.UPLOADS,myHelper.DOWNLOADS};
      Cursor cursor = db.query(myHelper.TABLE_NAME_LOCATION, columns, null, null, null, null, null);
      int cnt = cursor.getCount();
      Houses[] listings = new Houses[cnt];
      cnt = 0;
      while (cursor.moveToNext()) {
          int index0 = cursor.getColumnIndex(myHelper.UID);
          int index1 = cursor.getColumnIndex(myHelper.ADDRESS);
          int index2 = cursor.getColumnIndex(myHelper.STREET);
          int index3 = cursor.getColumnIndex(myHelper.CITY);
          int index4 = cursor.getColumnIndex(myHelper.STATE);
          int index5 = cursor.getColumnIndex(myHelper.ZIP);
          int index6 = cursor.getColumnIndex(myHelper.ENTIRE_ADDRESS);
          int index7 = cursor.getColumnIndex(myHelper.UPLOADS);
          int index8 = cursor.getColumnIndex(myHelper.DOWNLOADS);
          String z = cursor.getString(index0);
          String a = cursor.getString(index1);
          String b = cursor.getString(index2);
          String c = cursor.getString(index3);
          String d = cursor.getString(index4);
          String e = cursor.getString(index5);
          String f = cursor.getString(index6);
          String g = cursor.getString(index7);
          String h = cursor.getString(index8);
          listings[cnt] = new Houses(z,a,b,c,d,e,f,g,h);
          Log.d(TAG, listings[cnt].UID + listings[cnt].address + listings[cnt].street + listings[cnt].city + listings[cnt].state + listings[cnt].zip + listings[cnt].upload + listings[cnt].download);
          //buffer.append(f + "\n");
          cnt++;
      }
      //Log.d(TAG, "Returning From getData");
      //return listings;
      cursor.close();
      db.close();
  
      return "";
      //return listings;
  }
  </code></pre>