コード例 #1
0
  public void addOrder(Order order) {
    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues values = new ContentValues();
    values.put(KEY_ID, order.getId()); // Contact Name
    values.put(KEY_TABLE_ID, order.getTable().getId()); // Contact Phone Number
    values.put(KEY_CREATED_AT, order.getCreated_at());
    values.put(KEY_UPDATED_AT, order.getUpdated_at());

    // Inserting Row
    db.insert(TABLE_ORDERS, null, values);

    ordersAdapter.aNotifyDataSetChanged();
    db.close(); // Closing database connection
  }
コード例 #2
0
 public void removeOrder(Order order) {
   SQLiteDatabase db = this.getWritableDatabase();
   db.delete(TABLE_ORDERS, "id = ?", new String[] {String.valueOf(order.getId())});
   ordersAdapter.aNotifyDataSetChanged();
   db.close();
 }