mUrl += "?"; HashMap<String,String> map = new HashMap<>(); map.put("username",App.currentUser.username); map.put("month",mMonth); map.put("year",mYear); for (Map.Entry<String, String> en:map.entrySet() ) { try { if (!TextUtils.isEmpty(en.getValue())) { mUrl += "&" + en.getKey() + "=" + URLEncoder.encode(en.getValue(), "UTF-8"); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } mUrl = mUrl.replace("?&", "?");
Url请求get拼接
最新推荐文章于 2022-05-03 11:46:22 发布