获取Url中的参数的工具方法
/** * 获得url中参数 * @param url * @return */ public static Map<String, String> getParameter(String url) { Map<String, String> map = new HashMap<>(); try { if (url.indexOf('?') != -1) { final String contents = url.substring(url.indexOf('?') + 1); String[] keyValues = contents.split("&"); for (int i = 0; i < keyValues.length; i++) { String key = keyValues[i].substring(0, keyValues[i].indexOf("=")); String value = keyValues[i].substring(keyValues[i].indexOf("=") + 1); map.put(key, value); } } } catch (Exception e) { e.printStackTrace(); } return map; }