Reputation: 955
I have this method and the first log prints, the others don't
What am I doing wrong?
That is this :Log.d("insideGetFriends","in"); Gets printed and I looked in my log,
Log.d("facebookError",Integer.toString(graphUsers.size())); and the remaining lines do not get executed.
public ArrayList<ParseUser> getFriends(Session session)
{
Log.d("insideGetFriends","in");
final ArrayList<ParseUser> users=new ArrayList<>();
Request.newMyFriendsRequest(session,new Request.GraphUserListCallback() {
@Override
public void onCompleted(List<GraphUser> graphUsers, Response response) {
Log.d("facebookError",Integer.toString(graphUsers.size()));
for(GraphUser user:graphUsers)
{
String facebookId=user.getId();
Log.d("facebookFriend",facebookId);
ParseQuery<ParseUser> query=ParseUser.getQuery();
query.whereEqualTo("facebookID",facebookId);
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> parseUsers, ParseException e) {
users.add(parseUsers.get(0));
}
});
}
}
});
return users;
}
Upvotes: 0
Views: 119
Reputation: 2429
It looks like you are not starting/executing the request.
You need to store the result of Request.newMyFriendsRequest(...)
in a variable and then call .executeAsync()
on it.
This is explained here: https://developers.facebook.com/docs/android/graph#userdata
Upvotes: 7