Page 89 - 3-2
P. 89

if (success == 1) {
                                // products found
                                // Getting Array of Products
                                products = json.getJSONArray(TAG_PRODUCTS);


                                // looping through All Products
                                for (int i = 0; i < products.length(); i++) {
                                    JSONObject c = products.getJSONObject(i);


                                    // Storing each json item in variable
                                    String code = c.getString(TAG_CODE);
                                    String name = c.getString(TAG_NAME);
                                    String num ="1";
                                    String price = c.getString(TAG_PRICE);


                                    sum_price+=Integer.valueOf(price).intValue();




                                    Log.d(" 여긴가_delete", code);




                                    // creating new HashMap
                                    HashMap<String, String> map = new HashMap<String, String>();


                                    // adding each child node to HashMap key => value
                                    map.put(TAG_CODE, code);
                                    map.put(TAG_NAME, name);
                                    map.put(TAG_NUM, num);
                                    map.put(TAG_PRICE, price);




                                    // adding HashList to ArrayList
                                    productsList.add(map);


                                    Log.d(" 여긴가", "7.3_allproducts");
                                }
                                //sum_price=sum_price+Integer.parseInt(price);
                                all_price=sum_price;


                                sum_price=0;
                            } else {
                                Log.d(" 여긴가", "7.3333333_  설마 너 else   니.....?");
                                // no products found
                                // Launch Add New product Activity


                                                         - 89 -
   84   85   86   87   88   89   90   91   92   93   94