Reputation: 3075
I am new in Facebook integration with android. I've logged in to Facebook by using facebook-android-SDK. Now I want to get all friends details and display in ListView. How can I do this?
Please help me
Thanks in advance
Upvotes: 2
Views: 7899
Reputation: 4255
You can do by this way :
Using the graph API: https://graph.facebook.com/me/friends?access_token="your access_token"
Upvotes: 0
Reputation: 4048
I would recommend following the tutorial on Fetching User Data and then instead of executing
...
if (state.isOpened()) {
userInfoTextView.setVisibility(View.VISIBLE);
// Request user data and show the results
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
// Display the parsed user info
userInfoTextView.setText(buildUserInfoDisplay(user));
}
}
});
}
...
use Request.executeMyFriendsRequestAsync which is part of the Request class.
EDIT: Which also has the advantage of using the Facebook Android SDK to parse the response.
Upvotes: 3
Reputation: 896
Go with following code to get frends list :
Bundle params = new Bundle();
params.putString("fields", "name, picture");
JSONObject jsonFrends = Util.parseJson(facebook.request("me/friends", params));
Upvotes: 6