これは私が友達情報を取得する方法です:
private void getFriendsInfo() {
if (currentSession != null && currentSession.isOpened()) {
Log.d("fql started", "staarted");
String fqlQuery = "select uid, name, hometown_location, pic_square from user where uid in (select uid2 from friend where uid1 = me() LIMIT 20)";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Request request = new Request(currentSession,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
@Override
public void onCompleted(Response response) {
Log.i(TAG, "Got results: " + response.toString());
//here i want to assign String[] uid, name, location, image.
}
});
Request.executeBatchAsync(request);
} else {
Log.d("getFriendsInfo", "else activated");
}
}
ログキャット:
Got results: {Response: responseCode: 200, graphObject:GraphObject{graphObjectClass=GraphObject,
state={"data":[
{"pic_square":"https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-ash2\/1115780_13962124_1029801849_q.jpg",
"uid":13962124,
"hometown_location":null,
"name":"Jenny Rader"},
{"pic_square":"https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-ash1\/276378_33807714_6690800_q.jpg",
"uid":33807714,
"hometown_location":null,
"name":"John J. Rader"}
検索しましたが、Facebookからリクエストを取得する方法しか見つかりませんでした。
String[] uid, name, location, image で fqlQuery からデータを取得するにはどうすればよいですか?