Back to project page hacktoolkit-android_lib.
The source code is released under:
MIT License
If you think the Android project hacktoolkit-android_lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.hacktoolkit.android.api_helpers; //from w w w .j av a2 s . co m import java.util.ArrayList; import java.util.List; import com.facebook.Request; import com.facebook.Response; import com.facebook.model.GraphUser; import com.parse.ParseException; import com.parse.ParseFacebookUtils; import com.parse.ParseQuery; import com.parse.ParseUser; public class FacebookHelper { public static void getFriends(final HTKCallback callback) { Request.newMyFriendsRequest(ParseFacebookUtils.getSession(), new Request.GraphUserListCallback() { @Override public void onCompleted(List<GraphUser> users, Response response) { if (users != null) { List<String> friendsList = new ArrayList<String>(); for (GraphUser user : users) { friendsList.add(user.getId()); } // Construct a ParseUser query that will find friends whose // Facebook IDs are contained in the current user's friend list. ParseQuery<ParseUser> friendQuery = ParseQuery.getQuery("ParseUser"); friendQuery.whereContainedIn("fbId", friendsList); // findObjects will return a list of ParseUsers that are friends with // the current user try { List<ParseUser> friendUsers = friendQuery.find(); callback.execute(friendUsers); } catch (ParseException e) { // poop! } } } }).executeAsync(); } }