Android Facebook获取好友id

Android Facebook获取好友id,android,facebook,Android,Facebook,可能重复: 我正在尝试在Android上获取我所有朋友的facebook ID。这是我使用的代码: public static List<String> getFaceBookFriendsIDs() { List<String> friendsList = null; try { JSONObject result = new JSONObject(ParseFacebookUtils.getFacebook(

可能重复:

我正在尝试在Android上获取我所有朋友的facebook ID。这是我使用的代码:

public static List<String> getFaceBookFriendsIDs() {

        List<String> friendsList = null;
        try {
            JSONObject result = new JSONObject(ParseFacebookUtils.getFacebook().request("me/friends"));
            JSONArray friendsArray = result.getJSONArray("data");

            friendsList = new ArrayList<String>();
            for (int i = 0; i < friendsArray.length(); i++) {
                friendsList.add(friendsArray.getJSONObject(i).getString("id"));
            }
        } 
        catch (MalformedURLException e) {
            e.printStackTrace();

        } 
        catch (JSONException e) {
            e.printStackTrace();

        } 
        catch (IOException e) {
            e.printStackTrace();

        }

        return friendsList;

    }
然而,列表中的sise值与我拥有的朋友数不同。这是正常的,还是我做错了什么?

使用RESTFBAPI! 使一切变得更容易,并可能产生一些开销,但仍然可能更容易