/**
   * This function will update the item that the seller has selected with the new attributes, if the
   * info given was valid.
   */
  public void updateInventory() {
    if ((nameET.getText().toString().equals(""))
        || (descriptionET.getText().toString().equals(""))
        || (quantityET.getText().toString().equals(""))
        || (invoicePriceET.getText().toString().equals(""))
        || (sellPriceET.getText().toString().equals(""))) {
      Toast.makeText(
              getApplicationContext(),
              "Please Fill all Fields before submitting.",
              Toast.LENGTH_SHORT)
          .show();
    } else {
      try {
        name = nameET.getText().toString();
        description = descriptionET.getText().toString();
        quantity = Integer.parseInt(quantityET.getText().toString());
        invoicePrice = Double.parseDouble(invoicePriceET.getText().toString());
        sellPrice = Double.parseDouble(sellPriceET.getText().toString());
        if ((invoicePrice < 0) || (sellPrice < 0)) {
          throw new NumberFormatException();
        }
        invoicePrice = round(invoicePrice, 2);
        sellPrice = round(sellPrice, 2);

        Product p = new Product(name, invoicePrice, sellPrice, quantity, description, seller);
        p.setId(id);

        db.updateSellersProduct(p.getId(), p);

        Intent k = new Intent(SellerChangeAttributes.this, SellerMainPage.class);
        startActivity(k);
      } catch (NumberFormatException e) {
        Toast.makeText(
                getApplicationContext(),
                "Make sure price fields are non negative decimal values",
                Toast.LENGTH_SHORT)
            .show();
      } catch (IllegalArgumentException e) {
        Toast.makeText(getApplicationContext(), "Please Fill all Fields.", Toast.LENGTH_SHORT)
            .show();
      }
    }
  }