簡體   English   中英

無法在Android中使用Graph API獲取Facebook牆貼的所有評論

[英]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);
   }                       
}

我通常聽說Facebook GraphApi沒有提供預期的足夠信息。

我建議您使用FQL(更底層的方法)來獲取數據。 答案和鏈接中描述了FQL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM