这是我获取朋友信息的方法:
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 获取数据?