public boolean equals(Purchase pur) { if (this.item.equals(pur.getItem()) && this.category == pur.getCategory() && this.date.equals(pur.getDate())) { return true; } else { return false; } }
public boolean addRecord(Purchase purchase) { // extract data from item; ContentValues contentValues = new ContentValues(); contentValues.put(COL_2, purchase.getName()); contentValues.put(COL_3, purchase.getPrice()); contentValues.put(COL_4, purchase.getDate()); contentValues.put(COL_5, purchase.getNotePath()); // I am storing the name of of the enum, not the int value contentValues.put(COL_6, purchase.getCategory().name()); SQLiteDatabase db = getWritableDatabase(); db.insert(PURCHASE_TABLE, null, contentValues); db.close(); return true; }