//记录一下、留给自己的、
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对象解析需要的内容
*/
android开发、使用Json传递数据、
最新推荐文章于 2022-07-20 15:22:16 发布