我正在與Facebook集成的Android應用程序。我正在使用fql查詢從Facebook獲取信息。我的fql方法是如何從Json對象獲取數據?
void runfql(){
String fqlQuery = "SELECT uid, name, pic_small,birthday FROM user WHERE uid IN " +
"(SELECT uid2 FROM friend WHERE uid1 = me())";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
public void onCompleted(Response response) {
JSONObject myjson=response.getGraphObject().getInnerJSONObject();
Log.d("ResultResultResult: " ,""+myjson);
}
});
Request.executeBatchAsync(request);
}
myjson object has all info i want。像這樣
{"data":[{"uid":536089174,"birthday":"July 22","name":"Usman Aslam Sheikh"},{"uid":581379174,"birthday":"July 26","name":"Ammar Khalid"}
問題是如何將這些信息存儲到不同的數組?
請正確使用此代碼。
你找的JSONObject和JSONArray?或GSON也許? – BobTheBuilder 2013-04-10 06:57:55