public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.purchaselistrow, null); } PurchaseHistoryEntity watchListAllEntity = items.get(position); if (watchListAllEntity != null) { // TextView nt = (TextView) // v.findViewById(R.id.fileNameTextView); TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1); TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2); TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3); TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4); TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5); /*STATUS 注文日 (order date) 納品日 (delivery date) 依頼枚数(no. of request) 納品枚数(no. of delivery)*/ tv1.setText("STATUS: " + watchListAllEntity.get_status_ja()); tv2.setText("注文日: " + watchListAllEntity.get_order_created_at()); tv3.setText("納品日: " + watchListAllEntity.get_order_created_at()); tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount()); tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount()); } return v; }
private void PopulateListByJSONArray() { try { String newtime = Utility.getdate(); String accesskey = Utility.MD5_Hash(Constants.email + newtime + "moko"); Constants.ACCESS_KEY = accesskey; Constants.proc_date = newtime; JSONArray response; if (CheckInternet.checkConn(PurchaseHistory.this)) { response = Utility.getPurchaseHistory(); } else { response = null; } if (response != null) { for (int i = 0; i < response.length(); i++) { JSONObject jObj = response.getJSONObject(i); JSONArray cardsArray = jObj.getJSONArray("cards"); String orderCreationDate = jObj.getString("created_at"); for (int j = 0; j < cardsArray.length(); j++) { JSONObject jo = cardsArray.getJSONObject(j).getJSONObject("card"); PurchaseHistoryEntity purchaseHistoryEntity = new PurchaseHistoryEntity(); purchaseHistoryEntity.set_original_image_url(jo.getString("original_image_url")); purchaseHistoryEntity.setBuilding(jo.getString("building")); purchaseHistoryEntity.setAddress1(jo.getString("address1")); purchaseHistoryEntity.setZip(jo.getString("zip")); purchaseHistoryEntity.setSei(jo.getString("sei")); purchaseHistoryEntity.set_mail_address(jo.getString("email")); purchaseHistoryEntity.set_file_path(jo.getString("file_path")); purchaseHistoryEntity.set_created_at(jo.getString("created_at")); purchaseHistoryEntity.setAddress2(jo.getString("address2")); purchaseHistoryEntity.set_company_name(jo.getString("company_name")); purchaseHistoryEntity.set_company_kana(jo.getString("company_kana")); purchaseHistoryEntity.setAddress3(jo.getString("address3")); purchaseHistoryEntity.set_updated_at(jo.getString("updated_at")); purchaseHistoryEntity.set_proc_card_id(jo.getString("proc_card_id")); purchaseHistoryEntity.setUrl(jo.getString("url")); purchaseHistoryEntity.set_status_ja(jo.getString("status_ja")); purchaseHistoryEntity.setSeimei(jo.getString("seimei")); purchaseHistoryEntity.setMemo(jo.getString("memo")); purchaseHistoryEntity.setKeitai(jo.getString("keitai")); purchaseHistoryEntity.setAddress4(jo.getString("address4")); // purchaseHistoryEntity.setYakusyoku(jo.getString("yakusyoku")); purchaseHistoryEntity.set_thumbnail_image_url1(jo.getString("thumbnail_image_url1")); purchaseHistoryEntity.set_thumbnail_image_url2(jo.getString("thumbnail_image_url2")); purchaseHistoryEntity.set_thumbnail_image_url3(jo.getString("thumbnail_image_url3")); purchaseHistoryEntity.set_thumbnail_image_url4(jo.getString("thumbnail_image_url4")); purchaseHistoryEntity.setTel(jo.getString("tel")); purchaseHistoryEntity.set_mei_kana(jo.getString("mei_kana")); purchaseHistoryEntity.setId(jo.getString("id")); purchaseHistoryEntity.set_file_name(jo.getString("file_name")); purchaseHistoryEntity.set_user_id(jo.getString("user_id")); purchaseHistoryEntity.setMei(jo.getString("mei")); purchaseHistoryEntity.set_file_size(jo.getString("file_size")); /* purchaseHistoryEntity.set_file_extension(jo .getString("file_extension"));*/ purchaseHistoryEntity.setFax(jo.getString("fax")); purchaseHistoryEntity.set_sei_kana(jo.getString("sei_kana")); // watchListAllEntity.setBusyo(jo.getString("busyo")); purchaseHistoryEntity.setStatus(jo.getString("status")); purchaseHistoryEntity.set_order_created_at(orderCreationDate); purchaseHistoryEntity.set_order_amount(cardsArray.length() + ""); listrow.add(purchaseHistoryEntity); } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } runOnUiThread(returnRes); }