简体   繁体   English

无法在Android中使用Graph API获取Facebook墙贴的所有评论

[英]Unable to get all comments of facebook wall posts using Graph API in android

I have created my application integrated with Facebook to get feed from that. 我创建了与Facebook集成的应用程序以从中获取提要。 I actually get the responses properly, but the issue now is that I'm not able to get all comments using graph API. 实际上,我可以正确地获得响应,但是现在的问题是,我无法使用图形API获得所有注释。 Suppose one of the posts has 30 comments and I'm getting only the last 2 comments of every post in facebook wall using List view. 假设其中一个帖子有30条评论,而我使用“列表”视图在Facebook墙中仅获得每个帖子的最后2条评论。

Please help me to get all comments from the posts. 请帮助我从帖子中获取所有评论。 Thanks in advance. 提前致谢。 This is my Snippet of code using JSON parsing. 这是我使用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);
   }                       
}

I usually heard that Facebook GraphApi does not give enough information as expected. 我通常听说Facebook GraphApi没有提供预期的足够信息。

I suggest you to use FQL, more lower level method to fetch the data. 我建议您使用FQL(更底层的方法)来获取数据。 FQL is described in this answer and this link. 答案和链接中描述了FQL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM