[英]Unable to get all comments of facebook wall posts using Graph API in android
我创建了与Facebook集成的应用程序以从中获取提要。 实际上,我可以正确地获得响应,但是现在的问题是,我无法使用图形API获得所有注释。 假设其中一个帖子有30条评论,而我使用“列表”视图在Facebook墙中仅获得每个帖子的最后2条评论。
请帮助我从帖子中获取所有评论。 提前致谢。 这是我使用JSON解析的代码片段。
childList=new ArrayList<HashMap<String,Object>>();
HashMap<String, Object> childlist_hashMap=new HashMap<String, Object>();
JSONObject comments_Show=data.getJSONObject(i).getJSONObject("comments");
if(comments_Show.has("data"))
{
JSONArray datacomments=comments_Show.getJSONArray("data");
for(int c=0;c<datacomments.length();c++) {
childlist_hashMap=new HashMap<String, Object>();
childlist_hashMap.put("UserName", datacomments.getJSONObject(c).getJSONObject("from").getString("name"));
URL url= new URL("http://graph.facebook.com/"+datacomments.getJSONObject(c).getJSONObject("from").getString("id")+"/picture?type=normal");
childlist_hashMap.put("Image", BitmapFactory.decodeStream(url.openConnection().getInputStream()));
childlist_hashMap.put("CommentsFull",datacomments.getJSONObject(c).getString("message"));
childlist_hashMap.put("Comments_id",datacomments.getJSONObject(c).getString("id"));
childlist_hashMap.put("Comments_date",datacomments.getJSONObject(c).getString("created_time"));
childList.add(childlist_hashMap);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.