0

我正在尝试对我的 android 应用程序进行更新,以适应最近 facebook 对图片的更改。以前我只是为用户照片返回一个字符串,但没有返回一个数组。我已经更新了我的代码,但数据只是返回空值,有人能指出我正确的方向吗?

谢谢

GSON 呼叫

Gson gson = new GsonBuilder().create();
FBFriendResponse resp = gson.fromJson(response, FBFriendResponse.class);

新的 facebook 数据结构

"picture": {
    "data": {
       "url": "######.jpg",
       "is_silhouette": false
    }
 }


public class FBFriend implements Comparable<FBFriend>
{
    public String id, name, gender;
    public FBFriendPicture picture;

    @Override
    public int compareTo(FBFriend another) {
        return this.name.compareTo(another.name);       
    }

}
public class FBFriendPicture 
{
    public FBFriendPictureData pictureData;
}

public class FBFriendPictureData 
{
    public String friendPictureURL;
    public Boolean friendPictureIssilhouette;
}
4

1 回答 1

0

解决了这个问题。这是由于类中使用了错误的名称

public class FBFriend implements Comparable<FBFriend>
{
    public String id, name, gender;
    public FBFriendPicture picture;

    @Override
    public int compareTo(FBFriend another) {
        return this.name.compareTo(another.name);       
    }

}
public class FBFriendPicture 
{
    public FBFriendPictureData data;
}

public class FBFriendPictureData 
{
    public String url;
    public Boolean is_silhouette;
}
于 2012-10-22T09:14:00.750 回答