Page 104 - 3-2
P. 104
// looping through All Products
Log.d(" 여긴가","owner_5-9,for 문들어옴");
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);
owner_compare_price+=Integer.valueOf(price).intValue();
Log.d(" 여긴가 price",price);
// 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_PRICE, price);
// adding HashList to ArrayList
productsList3.add(map);
}
Log.d(" 여긴가","owner_5-10,for 문 끝남");
//sum_price=sum_price+Integer.parseInt(price);
owner_compare_all_price=owner_compare_price;
owner_compare_price=0;
} else {
Log.d(" 여긴가", "owner_5-11111111_ 너 혹시 else 니???");
// no products found
// Launch Add New product Activity
Intent i = new Intent(getApplicationContext(),
MainActivity_owner_compare_yet.class);
// Closing all previous activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
} catch (JSONException e) {
Log.d(" 오류남: ", e.getMessage());
- 104 -