public void doUnAttTask(final Father host) { if (mUser != null) { String cancelId = ""; AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put("uid", mUser.getUid()); params.put("token", mUser.getToken()); for (int i = 0; i < hostAtts.size(); i++) { Host hosts = hostAtts.get(i); if (hosts.getUid().equals(host.getUid())) { cancelId = hosts.getHostAttId(); break; } } params.put("cancleId", cancelId); asyncHttpClient.post( AppConstants.PAY_HOST_UNATTE, params, new AsyncHttpResponseHandler() { @Override public void onStart() { super.onStart(); mDialog = Utils.showProgressDialog(TraceHostSeeActivity.this, "操作中……"); mDialog.show(); } @Override public void onSuccess(String content) { super.onSuccess(content); mDialog.dismiss(); if (content != null) { JSONObject jsonObject; try { jsonObject = new JSONObject(content); boolean success = jsonObject.getBoolean("success"); if (success == true) { Utils.MakeToast(getApplicationContext(), "取消成功"); getHostAtt(); } else { String message = jsonObject.optString("msg"); Utils.MakeToast(getApplicationContext(), message); } } catch (Exception e) { e.printStackTrace(); } } } @Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); mDialog.dismiss(); Utils.MakeToast(getApplicationContext(), "网络连接超时"); } }); } else { Utils.MakeToast(getApplicationContext(), "请先登录"); } }
public boolean hasAtten(Father host) { for (int i = 0; i < hostAtts.size(); i++) { Host host2 = hostAtts.get(i); if (host2.getUid().equals(host.getUid())) { return true; } } return false; }