private void setData() { final GlobalItemListModel query = AllGlobalItemList.getAllNewsFeedList().elementAt(position); sd_detail.setText(query.getDescription()); sd_prices.setText("$ " + query.getItem_price()); // sd_places.setText(query.getItem_venues()); cd_title.setText(query.getTitle()); placesArray = query.getVenue_name().split(","); placesID = query.getItem_venues().split(","); loadImage(query.getImage()); if (placesArray.length == 1) { sd_places.setText(query.getVenue_name()); } else { sd_places.setText("Valid In " + placesArray.length + " Places"); } }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.sd_back: finish(); break; case R.id.sd_addto_cart: final GlobalItemListModel queryGlobalItemListModel = AllGlobalItemList.getAllNewsFeedList().elementAt(position); JSONObject jsonObj = new JSONObject(); jsonObj.put("ID", "" + queryGlobalItemListModel.getId()); jsonObj.put("TITLE", queryGlobalItemListModel.getTitle()); jsonObj.put("PRICE", queryGlobalItemListModel.getItem_price()); jsonObj.put("QUANTITY", "1"); jsonObj.put("DETAIL", queryGlobalItemListModel.getDescription()); jsonObj.put("UNIT_PRICE", queryGlobalItemListModel.getItem_price()); AppConstant.ADDTOCART = jsonObj; jsonUtility.createJsonFile(jsonObj, context); finish(); break; case R.id.placemore_relative: if (placesArray.length == 1) { sd_moreplace.setVisibility(View.GONE); Toast.makeText(context, "Clicked", Toast.LENGTH_SHORT).show(); } else { if (sd_moreplace.getVisibility() == View.VISIBLE) { sd_moreplace.setVisibility(View.GONE); } else { sd_moreplace.setVisibility(View.VISIBLE); placesAdapter = new PlacesAdapter(context, placesArray, placesID); sd_moreplace.setAdapter(placesAdapter); setListView(sd_moreplace); placesAdapter.notifyDataSetChanged(); } } break; } }