public String getInfo() { Map<String, String> map = new HashMap<String, String>(); map.put("language", "zh-CN"); map.put("sensor", "false"); map.put("latlng", getLatlng()); String url = URLHelper.GOOGLELOCATION; String jsonData = null; try { jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); } catch (WeiboException e) { AppLogger.e(e.getMessage()); } try { JSONObject jsonObject = new JSONObject(jsonData); JSONArray results = jsonObject.optJSONArray("results"); JSONObject jsonObject1 = results.getJSONObject(0); String formatAddress = jsonObject1.optString("formatted_address"); int index = formatAddress.indexOf(" "); if (index > 0) { String location = formatAddress.substring(0, index); return location; } else { return formatAddress; } } catch (JSONException e) { AppLogger.e(e.getMessage()); } return ""; }
public List<String> getInfo() throws WeiboException { String url = URLHelper.GROUP_MEMBER_LIST; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("uids", uids); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); Gson gson = new Gson(); List<GroupUser> value = null; try { value = gson.fromJson(jsonData, new TypeToken<List<GroupUser>>() {}.getType()); } catch (JsonSyntaxException e) { AppLogger.e(e.getMessage()); } if (value != null && value.size() > 0) { GroupUser user = value.get(0); List<String> ids = new ArrayList<String>(); for (GroupBean b : user.lists) { ids.add(b.getIdstr()); } return ids; } return null; }
private static boolean getBitmapFromNetWork( String url, String path, FileDownloaderHttpHelper.DownloadListener downloadListener) { for (int i = 0; i < 3; i++) { if (HttpUtility.getInstance().executeDownloadTask(url, path, downloadListener)) { return true; } } return false; }
private static boolean getBitmapFromNetWork( String url, String path, FileDownloaderHttpHelper.DownloadListener downloadListener) { // for (int i = 0; i < AppConfig.RETRY_TIMES; i++) { boolean result = HttpUtility.getInstance().executeDownloadTask(url, path, downloadListener); if (result) return true; // } return false; }
private String getMsgListJson() throws WeiboException { String url = URLHelper.TAGS; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("uid", uid); map.put("count", count); map.put("page", page); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); return jsonData; }
private boolean sendNewMsgWithPic(String str, FileUploaderHttpHelper.ProgressListener listener) throws WeiboException { String url = URLHelper.STATUSES_UPLOAD; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("status", str); if (geoBean != null) { map.put("lat", String.valueOf(geoBean.getLat())); map.put("long", String.valueOf(geoBean.getLon())); } return HttpUtility.getInstance().executeUploadTask(url, map, pic, listener); }
private String getJson() throws WeiboException { String url = URLHelper.TIMELINE_RE_CMT_COUNT; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); StringBuilder idsBuilder = new StringBuilder(); for (String id : msgIds) { idsBuilder.append(",").append(id); } map.put("ids", idsBuilder.toString()); return HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); }
public boolean sendNewMsg(String str, FileUploaderHttpHelper.ProgressListener listener) throws WeiboException { if (!TextUtils.isEmpty(pic)) { return sendNewMsgWithPic(str, listener); } String url = URLHelper.STATUSES_UPDATE; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("status", str); if (geoBean != null) { map.put("lat", String.valueOf(geoBean.getLat())); map.put("long", String.valueOf(geoBean.getLon())); } HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map); return true; }
public boolean destroy() throws WeiboException { String url = URLHelper.STATUSES_DESTROY; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("id", id); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map); Gson gson = new Gson(); try { MessageBean value = gson.fromJson(jsonData, MessageBean.class); } catch (JsonSyntaxException e) { AppLogger.e(e.getMessage()); return false; } return true; }
private String getMsgListJson() throws WeiboException { String url = getUrl(); Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("since_id", since_id); map.put("max_id", max_id); map.put("count", count); map.put("page", page); map.put("base_app", base_app); map.put("feature", feature); map.put("trim_user", trim_user); map.put("list_id", list_id); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map); return jsonData; }
public boolean destroy() throws WeiboException { String url = URLHelper.GROUP_DESTROY; Map<String, String> map = new HashMap<String, String>(); map.put("access_token", access_token); map.put("list_id", list_id); String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map); Gson gson = new Gson(); Result value = null; try { value = gson.fromJson(jsonData, Result.class); } catch (JsonSyntaxException e) { AppLogger.e(e.getMessage()); } return (value != null); }