/** * @param id * @return */ public Space getSpace(int id) { Space s = new Space(); Cursor c = db.query(TABLE_NAME, COLUMNS, String.format("id = %d", id), null, null, null, null); c.moveToFirst(); s.id = c.getInt(0); s.name = c.getString(1); s.statusapi = c.getString(2); c.close(); return s; }
/** @return */ public Space[] getAllSpaces() { ArrayList<Space> spaces = new ArrayList<Space>(); Cursor c = db.query(TABLE_NAME, COLUMNS, null, null, null, null, null); c.moveToFirst(); while (!c.isAfterLast()) { Space s = new Space(); s.id = c.getInt(0); s.name = c.getString(1); s.statusapi = c.getString(2); spaces.add(s); c.moveToNext(); } c.close(); return (Space[]) spaces.toArray(); }