private void netdelete() { // 判断是否登录 String userID = SPUtils.getUserID(context); if (TextUtils.isEmpty(userID)) { Intent intent = new Intent(context, LoagingActivity.class); startActivity(intent); } else { boolean connection = NetworkUtils.isConnection(context); if (!connection) { showWords("当前网络不可用,请你检查网络的情况"); return; } utils.show(); NetHead head = new NetHead(context); RequestParams params = head.setHeader(); params.addBodyParameter("houseId", mListBean.get(deleteTag).sid); params.addBodyParameter("type", "deleteColect"); params.addBodyParameter("userId", SPUtils.getUserID(context)); if (http == null) { http = new HttpUtils(); } http.send( HttpMethod.POST, UrlsUtils.urls, params, new RequestCallBack<String>() { @Override public void onFailure(HttpException arg0, String arg1) { utils.closeDialog(); Toast.makeText(context, StreamTools.getString(), Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(ResponseInfo<String> arg0) { utils.closeDialog(); mListBean.remove(deleteTag); if (mListBean.size() == 0) { showWords((String) getResources().getText(R.string.collection_house)); } adapter.notifyDataSetChanged(); String result = arg0.result; JSONObject josn = null; try { josn = new JSONObject(result); String statue = josn.getString("status"); if (!"N".equals(statue)) { Toast.makeText(context, "删除成功", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } } }); } }
private void network() { boolean connected = NetworkUtils.isConnection(getActivity()); if (connected) { // 访问网络 utils = new DialogUtils(getActivity()); utils.show(); NetHead head = new NetHead(getActivity()); RequestParams params = head.setHeader(); params.addBodyParameter("type", "queryCollect"); params.addBodyParameter("userId", SPUtils.getUserID(getActivity())); params.addBodyParameter("houseT", "1"); if (http == null) { http = new HttpUtils(); } http.send( HttpMethod.POST, UrlsUtils.urls, params, new RequestCallBack<String>() { @Override public void onFailure(HttpException arg0, String arg1) { Toast.makeText(getActivity(), StreamTools.getString(), Toast.LENGTH_SHORT).show(); utils.closeDialog(); colseHeard(); } @Override public void onSuccess(ResponseInfo<String> arg0) { colseHeard(); mResult = arg0.result; utils.closeDialog(); praseJson(); } }); } else { // Toast.makeText(getActivity(), "当前网络不可用,请你检查网络的情况", Toast.LENGTH_SHORT).show(); showWords("当前网络不可用,请你检查网络的情况"); } }
private void loadInfo() { if (utils == null) { utils = new DialogUtils(context); } utils.show(); boolean isConnect = NetworkUtils.isConnection(context); if (isConnect) { NetHead head = new NetHead(context); RequestParams params = head.setHeader(); params.addBodyParameter("userId", userID); params.addBodyParameter("tenantId", tenantId); if (httpUtils == null) { httpUtils = new HttpUtils(); } httpUtils.send( HttpRequest.HttpMethod.POST, UrlsUtils.getUrlReleaseLoadInfo, params, new RequestCallBack<String>() { @Override public void onSuccess(ResponseInfo<String> objectResponseInfo) { Toast.makeText(context, "获取详情信息成功", Toast.LENGTH_SHORT).show(); Log.e("EEEEEEEEEEEEEE", "EEEEEEEEEEEEE---求租" + objectResponseInfo.result); try { if (map_release_load == null) { map_release_load = new HashMap<>(); } JSONObject jsonObject = new JSONObject(objectResponseInfo.result); if ("Y".equals(jsonObject.getString("status"))) { JSONObject jsonObject1 = jsonObject.getJSONObject("data"); map_release_load.put("createTimeStr", jsonObject1.getString("createTimeStr")); map_release_load.put("checkInTimeStr", jsonObject1.getString("checkInTimeStr")); map_release_load.put("constellation", jsonObject1.getString("constellation")); map_release_load.put("interest", jsonObject1.getString("interest")); map_release_load.put("tenantId", jsonObject1.getString("tenantId")); map_release_load.put("description", jsonObject1.getString("description")); map_release_load.put("age", jsonObject1.getString("age")); map_release_load.put("sex", jsonObject1.getString("sex")); map_release_load.put("district", jsonObject1.getString("district")); map_release_load.put("title", jsonObject1.getString("title")); map_release_load.put("rent", jsonObject1.getString("rent")); map_release_load.put("name", jsonObject1.getString("name")); map_release_load.put("nativePlaceName", jsonObject1.getString("nativePlaceName")); map_release_load.put("nativePlace", jsonObject1.getString("nativePlace")); map_release_load.put("phone", jsonObject1.getString("phone")); map_release_load.put("jobName", jsonObject1.getString("jobName")); map_release_load.put("job", jsonObject1.getString("job")); map_release_load.put("business", jsonObject1.getString("business")); map_release_load.put("schoolName", jsonObject1.getString("schoolName")); map_release_load.put("school", jsonObject1.getString("school")); map_release_load.put("headImg", jsonObject1.getString("headImg")); list_img_bottom = new ArrayList<String>(); JSONArray jsonArray = jsonObject1.getJSONArray("listAU"); for (int i = 0; i < jsonArray.length(); i++) { String str = jsonArray.getString(i); list_img_bottom.add(str); } } } catch (JSONException e) { e.printStackTrace(); } showReleaseModify(map_release_load); utils.closeDialog(); } @Override public void onFailure(HttpException e, String s) { Toast.makeText(context, "获取信息失败", Toast.LENGTH_SHORT).show(); utils.closeDialog(); } }); } }