private static AmbientDB createAmbientFromCursor(final Cursor c) {
   AmbientDB data = new AmbientDB();
   data.ambientId = c.getString(0);
   data.temperature = c.getDouble(1);
   data.light = c.getInt(2);
   return data;
 }
  public static ArrayList<AmbientDB> readAmbient(final SQLiteDatabase db) {
    ArrayList<AmbientDB> ambientList = new ArrayList<AmbientDB>();
    Cursor c = null;
    try {
      c = db.rawQuery(AmbientDB.SELECT_SQL, null);

      if (c != null) {
        c.moveToFirst();
      }
      for (int i = 0; i < c.getCount(); i++) {
        c.moveToPosition(i);
        AmbientDB ambient = AmbientDB.createAmbientFromCursor(c);
        if (ambient != null) {
          ambientList.add(ambient);
        }
      }
    } finally {
      if (c != null) {
        c.close();
      }
    }
    return ambientList;
  }