Commit 53eb1a01 authored by Sam's avatar Sam

fixed crash errors

parent 47b056b8
......@@ -178,7 +178,10 @@ public class cafe_activity extends AppCompatActivity implements View.OnClickList
String cafeQuantity = cafeItemList.get(i).getQuantity();
String cafeName = cafeItemList.get(i).getItem();
String cafePrice = cafeItemList.get(i).getPrice();
if (!cafeQuantity.equals("0")) {
if (!cafeQuantity.equals("0") && !cafeQuantity.equals("")) {
Log.d("cafeQuantity", "The q is: " + cafeQuantity);
itemQuantityCafe.add(cafeQuantity);
itemNameCafe.add(cafeName);
itemPriceCafe.add(cafePrice);
......
......@@ -182,7 +182,7 @@ public class shop_activity extends AppCompatActivity implements View.OnClickList
String shopQuantity = shopItemList.get(i).getQuantity();
String shopItem = shopItemList.get(i).getItem();
String shopPriceName = shopItemList.get(i).getPrice();
if (!shopQuantity.equals("0")) {
if (!shopQuantity.equals("0") && !shopQuantity.equals("")) {
itemQuantityShop.add(shopQuantity);
itemNameShop.add(shopItem);
itemPriceShop.add(shopPriceName);
......
......@@ -131,6 +131,7 @@ public class checkout extends AppCompatActivity implements View.OnClickListener
int totalCafeItems = 0;
int totalShop = 0;
for (int i = 0; i < quantity.size(); i++) {
int currentQuantity = Integer.valueOf(quantity.get(i));
int currentPrice = Integer.valueOf(prices.get(i));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment