日期:2014-05-16 浏览次数:20427 次
//记录一下、留给自己的、 public static List<Follower> loadFollowerList(int uid) { try { list = new ArrayList<Follower>(); JSONObject jsonObject = new JSONObject(); jsonObject.put(Constants.JSON_ID, 1); jsonObject.put(Constants.JSON_METHOD, Constants.FOLLOWERLIST_QUERY); JSONObject jsonObject_param = new JSONObject(); jsonObject_param.put(Constants.UID, uid); jsonObject.put(Constants.JSON_PARAMS, jsonObject_param); jsonObject.put(Constants.JSON_RPC, Constants.RCP_NO); String responseString = HttpManager.executePost( Constants.URL_STRING, jsonObject.toString()); JSONObject resultObject = new JSONObject(responseString); JSONArray jsonArray = resultObject.getJSONArray(Constants.RESULT); for (int i = 0; i < jsonArray.length(); i++) { follower = new Follower(); follower.setFollowerName(jsonArray.getJSONObject(i).getString( "followername")); follower.setFollowerPic(jsonArray.getJSONObject(i).getString( "followerpic")); } } catch (Exception e) { System.out.println("error"); e.printStackTrace(); } return list; } /** 传入: {"id":1,"method":"followerlist.query","params":{"uid":"7"},"jsonrpc":"2.0"} 从传出的Json对象解析需要的内容 */