public void updateListHistoryGift(String custId) { // TODO Auto-generated method stub List<NameValuePair> nameValuePairs = ParameterFactory.updateHistoryList(custId); AsyncHttpPost postGetGiftList = new AsyncHttpPost( getActivity(), new AsyncHttpResponseProcess(getActivity()) { @Override public void processIfResponseSuccess(String response) { try { JSONObject jsonObject = new JSONObject(response); Gson gson = new Gson(); GiftHistoryList giftList = gson.fromJson(jsonObject.toString(), GiftHistoryList.class); setData(giftList.getGifts()); log.m(">>>>>>>>>>>>> " + giftList.getGifts().size()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void processIfResponseFail() { log.e("failed ", "failed"); } }, nameValuePairs, true); postGetGiftList.execute(WebServiceConfig.URL_GET_GIFT_HISTORY_LIST); }
public void requestCancelGift(final GiftHistoryItem item) { List<NameValuePair> nameValuePairs = ParameterFactory.requestCancelGift(item.getTxnId()); AsyncHttpPost postGetGiftList = new AsyncHttpPost( getActivity(), new AsyncHttpResponseProcess(getActivity()) { @Override public void processIfResponseSuccess(String response) { try { JSONObject jsonObject = new JSONObject(response); // log.m(">>>>>>>>>>>>> " + response); DialogUtility.alert(getActivity(), "Hủy quà thành công"); data.remove(item); setData(data); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); DialogUtility.alert(getActivity(), "Hủy quà thất bại"); } } @Override public void processIfResponseFail() { log.e("failed ", "failed"); } }, nameValuePairs, true); postGetGiftList.execute(WebServiceConfig.URL_REQUEST_CANCEL_GIFT); }