protected Void doInBackground(String... params) { /* * Insert */ try { HttpClient client = new DefaultHttpClient(); String postUrl; postUrl = "http://naddola.cafe24.com/insertWish.php"; HttpPost post = new HttpPost(postUrl); // 전달인자 List params2 = new ArrayList(); params2.add(new BasicNameValuePair("email", setting.getID())); params2.add(new BasicNameValuePair("title", myWishWeb.getTitle())); params2.add(new BasicNameValuePair("price", myWishWeb.getPrice() + "")); params2.add(new BasicNameValuePair("wish", myWishWeb.getWish() + "")); params2.add(new BasicNameValuePair("image", myWishWeb.getImagePath() + "")); UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params2, HTTP.UTF_8); post.setEntity(ent); HttpResponse responsePost = client.execute(post); HttpEntity resEntity = responsePost.getEntity(); } catch (Exception e) { e.printStackTrace(); } /* * Select */ try { HttpClient client = new DefaultHttpClient(); String postUrl; postUrl = "http://naddola.cafe24.com/getLastMyWish.php"; HttpPost post = new HttpPost(postUrl); // 전달인자 List params2 = new ArrayList(); params2.add(new BasicNameValuePair("email", setting.getID())); UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params2, HTTP.UTF_8); post.setEntity(ent); HttpResponse responsePost = client.execute(post); HttpEntity resEntity = responsePost.getEntity(); if (resEntity != null) { resp = EntityUtils.toString(resEntity); } } catch (Exception e) { e.printStackTrace(); } return null; }
public View getView(int position, View converView, ViewGroup parent) { View v = converView; ImageView mImage = null; TextView mTitle, mPrice = null; SearchViewHolder viewHolder; if (v == null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.custom_auto_list, null); mImage = (ImageView) v.findViewById(R.id.mImage); mTitle = (TextView) v.findViewById(R.id.mTitle); mPrice = (TextView) v.findViewById(R.id.mPrice); viewHolder = new SearchViewHolder(mImage, mTitle, mPrice, list.get(position).getImagePath()); v.setTag(viewHolder); } else { viewHolder = (SearchViewHolder) v.getTag(); mImage = viewHolder.mImage; mTitle = viewHolder.mTitle; mPrice = viewHolder.mPrice; } SearchData sData = list.get(position); if (sData != null) { new SearchImageThread(mImage).execute(sData.getImagePath()); mTitle.setText(sData.getTitle()); mPrice.setText( "쇼핑몰 최저가 : " + df.format(sData.getPrice()) + " 원\n" + "Wish : " + df.format(sData.getWish()) + " \n"); } return v; }