2017-03-10 12 views
1

私はfacebook4jを使ってコメントの返答数を取得していますが、実際にはid_commentが何であれnullを返します。 ここに私が取得するコードはありますコメント;私はExcelのIDが なぜfacebook4jのgetcommentcountがnullを返すのですか?

enter code herepublic class RecuperationFacebook { 
public static String appId = "appId"; 
public static String appSecret = "appSecret"; 
public static String access_token = ""; 
public static Facebook facebook ; 
public RecuperationFacebook() 
{ 
    facebook = new FacebookFactory().getInstance(); 
    facebook.setOAuthAppId(appId, appSecret); 
    facebook.setOAuthAccessToken(new AccessToken(access_token)); 
} 
public static Comment Commentaire(String id_comment) throws FacebookException 
{ 
      Comment commentaire =facebook.getComment(id_comment, null); 
      commentaire.getFrom().getId(); 
      return(commentaire); 

} 

} //ファイルがあり、ここで私は、デフォルト以外のフィールドを機能

Comment commentaire = facebook.Commentaire(id_comment); 
     Integer Nb_reponse = commentaire.getCommentCount(); 
     System.out.println("Nb_reponse"+Nb_reponse); 

答えて

0

コメント数をされて使用している方法ですので、あなたは明示的にする必要がありそれをFacebook APIに応答に含めるように指示します。あなたはこれを達成するためにReading classを使用することができます。

Reading reading = new Reading().fields("comment_count"); 
facebook.getComment(commentId, reading); 

あなたがfacebook4jの公式documentationでより見つけることができます。

関連する問題